The following tables provide the formulas for estimating table size requirements.
Table G.1 Estimation formula when the record length is 2032 bytes or lessItem | Estimation formula (bytes) |
---|
(1) Record length | 23 + NULL map + OID + column data NULL map: Number of columns / 8 (*1) OID: 4 for a table "WITH OID". The default is 0. Column data: Sum of the lengths of columns (*2) *1: Rounded up to the next integer. *2: The length of each column depends on its data type (refer to "G.3 Sizes of Data Types" for details). You must adjust the sum length (record head + NULL map + OID) and record length so that they are a multiple of 8 bytes. For example, if the calculation gives 28 bytes, add 4 to make 32 bytes. Each column data length must be a multiple of a certain number of bytes, depending on the data type. For example, to align the storage location of INT type data to a multiple of 4 bytes, add 2 to the following table column data size so that 2 (size of c1)+2+4 (size of c2)=8 bytes. create table tb1(c1 char(1),c2 int) If the calculated record length exceeds 2032 bytes, variable-length data in the record may be automatically compressed. In this case, use the estimation formula given in "Table G.2 Estimation formula when the record length exceeds 2032 bytes" to estimate table size requirements.
|
(2) Number of records per page | 8168 (*1) / ((1) record length + 4 (*2)) *1: Page length (8192) - page head (24) *2: Pointer length (4) |
(3)Number of pages required for storing records | Total number of records / (2) number of records per page Round the number of pages required for storing records calculated at (3) to the nearest integer. |
(4) Amount of space | (3) Number of pages required for storing records x page length x safety factor (*1) *1: Specify 2.0 or higher. |
Table G.2 Estimation formula when the record length exceeds 2032 bytesItem | Estimation formula (bytes) |
---|
(4) Amount of space | Total number of records x (1) record length x safety factor (*1) *1: Specify 2.0 or higher. |