Rules for primary and secondary space allocation
You can specify the primary and secondary space allocation or let Db2 choose them. Having Db2 choose the values, especially the secondary space quantity, increases the possibility of reaching the maximum data set size before running out of extents.
In the following rules that describe how allocation works, these terms are used:
- PRIQTY, SECQTY
- The keywords for CREATE TABLESPACE, ALTER TABLESPACE, CREATE INDEX, and ALTER INDEX.
- specified-priqty
- The user-specified value for PRIQTY.
- specified-secqty
- The user-specified value for SECQTY.
- actual-priqty
- The actual primary space allocation, in kilobytes.
- actual-priqty-cylinders
- The actual primary space allocation, in cylinders.
- actual-secqty
- The actual secondary space allocation, in kilobytes.
- actual-secqty-cylinders
- The actual secondary space allocation, in cylinders.
- calculated-extent-cylinders
- A value that is calculated by Db2 using a sliding scale. A sliding scale means that the first secondary extent allocations are smaller than later secondary allocations. For example, Figure 1 shows the sliding scale of secondary extent allocations that Db2 uses for a 64-GB data set. The size of each secondary extent is larger for each secondary extent that is allocated up to the 127th extent. For the 127th secondary extent and any subsequent extents, the secondary size allocation is 559 cylinders.
Rules
- Rule 1: (for primary space allocation)
- If PRIQTY is specified and specified-priqty is not equal to -1, actual-priqty is at least specified-priqty KB.If PRIQTY is not specified or specified-priqty is equal to -1, actual-priqty is determined as follows:
- For a table space, if the TSQTY subsystem parameter value is specified and is greater than 0, actual-priqty is at least the value of TSQTY.
If the TSQTY subsystem parameter is not specified or is 0, actual-priqty is one cylinder for a non-LOB table space. actual-priqty is 10 cylinders for a LOB table space.
- For an index, if the IXQTY subsystem parameter value is specified and is greater than 0, actual-priqty is at least the value of IXQTY.
If the IXQTY subsystem parameter is not specified or is 0, actual-priqty is one cylinder.
- For a table space, if the TSQTY subsystem parameter value is specified and is greater than 0, actual-priqty is at least the value of TSQTY.
- Rule 2: (for secondary space allocation)
- If SECQTY is not specified, the following formulas determine actual-secqty:
- If the maximum size of a data set in the table space or index is less than 32 GB, the formula
is:
actual-secqty-cylinders= MAX(0.1*actual-priqty-cylinders, MIN(calculated-extent-cylinders, 127))
- If the maximum size of a data set in the table space or index is 32 GB or greater, the formula
is:
actual-secqty-cylinders= MAX(0.1*actual-priqty-cylinders, MIN(calculated-extent-cylinders, 559))
- If the maximum size of a data set in the table space or index is less than 32 GB, the formula
is:
- Rule 3 (for secondary space allocation)
- If SECQTY is 0, actual-secqty is 0.
- Rule 4 (for secondary space allocation)
- If SECQTY is specified and specified-secqty is not equal to -1 or 0, the following formulas determine actual-secqty. If the maximum size of a data set in the table space or index is less 32 GB, the formula is:
actual-secqty-cylinders= MAX(MIN(calculated-extent-cylinders, 127),specified-secqty-cylinders)
If the maximum size of a data set in the table space or index is 32 GB or greater, the formula is:actual-secqty-cylinders= MAX(MIN(calculated-extent-cylinders, 559),specified-secqty-cylinders)
- Rule 5 (for secondary space allocation):
- When a table space requires a new piece, the primary allocation quantity of the new piece is determined by using the maximum of the following values:
- The quantity that is calculated through sliding scale methodology
- The primary quantity from rule 1
- The specified SECQTY value