The formulas and examples that follow show how to calculate the sizes of tables and indexes. This example uses the same column sizes and index as the previous example. All of the formulas use the maximum size of the variable-length fields. See “Tables and indexes used in the formulas” for the specifications.
The formulas for data-only-locked tables are divided into two sets of steps:
Steps 1–3 outline the calculations for a data-only-locked table. The example that follows step 3 illustrates the computations on a table that has 9,000,000 rows.
Steps 4–8 outline the calculations for computing the space required by an index, followed by an example using the 9,000,000-row table.
optdiag output includes the average length of data rows and index rows. You can use these values for the data and index row lengths, if you want to use average lengths instead.
The steps are: