Example: Database file sizes

This example shows how to estimate the maximum size of a database file.

A *MAX1TB (4-byte) access path with 120 byte keys and 500 000 records TotalIndexSize has a TotalIndexSize in bytes as follows:
a = (LimbPageUtilization - LogicalPageHeaderSize) *
    (LogicalPageHeaderSize - LeafPageUtilization - 2 * NodeSize)
  = (6144 - 64) *
    (64 - 6554 - 2 * 4)
  = 6080 * -6498
  = -39,507,840
 
b = NumKeys * (KeySizeInBytes + 2 * NodeSize) *
    (LimbPageUtilization - LogicalPageHeaderSize + 2 * NodeSize)
    - 2 * NodeSize * (LeafPageUtilization - LogicalPageHeaderSize
    + 2 * NodeSize)
  = 500,000 * (120 + 2 * 4) *
    (6144 - 64 + 2 * 4)
    - 2 * 4 * (6554 - 64 + 2 * 4)
  = 500,000 * 128 *
    6088
    - 8 * 6498
  = 3.896319e+11
 
NumberLogicalPages = ceil[ -b/a ]
                   = ceil[ -3.896319e+11/-39507840 ]
                   = 9863
 
TotalIndexSize = NumberLogicalPages * LogicalPageSize
               = 9863 * 8192
               = 80,797,696 bytes
The equation for index size in previous versions of the operating system produces the following result:
TotalIndexSize = (number of keys) * (key length + 8) *
                 (0.8) * (1.85) + 4096
               = (NumKeys) * (KeySizeInBytes + 8) *
                 (0.8) * (1.85) + 4096
               = 500000 * 128 *
                 .8 * 1.85 + 4096
               = 94,724,096
 

This estimate can differ significantly from your file. The keyed sequence access path depends heavily on the data in your records. The only way to get an accurate size is to load your data and display the file description.

The following table shows a list of minimum file sizes.

Description Minimum size
Physical file without a member 8192 bytes
Physical file with a single member 20 480 bytes
Keyed sequence access path 12 288 bytes
Note: Additional space is not required for an arrival sequence access path.
In addition to the file sizes, the system maintains internal formats and directories for database files. (These internal objects are owned by user profile QDBSHR.) The following are estimates of the sizes of those objects:
  • For any file not sharing another file's format:
       Format size = (144 x number of fields) + 4096
  • For files sharing their format with any other file:
       Format sharing directory size = (16 x number of files
       sharing the format) + 4096
  • For each physical file and each physical file member having a logical file or logical file member built over it:
       Data sharing directory size = (16 x number of files
       or members sharing data) + 4096
  • For each file member having a logical file member sharing its access path:
       Access path sharing directory size = (16 x number of files
       or members sharing access path) + 4096