|
You can estimate the number of pages, and therefore the number of bytes required to store a file. However, when using the formulas, consider that they only approximate file size because of the way the transactional interface dynamically manipulates pages.
Note
The following discussion and the formulas for determining file size do not apply to files that use data compression, because the record length for those files depends on the number of repeating characters in each record.
While the formulas are based on the maximum storage required, they assume that only one task is updating or inserting records into the file at a time. File size increases if more than one task updates or inserts records into the file during simultaneous concurrent transactions.
The formulas also assume that no records have been deleted yet from the file. You can delete any number of records in the file, and the file remains the same size. The transactional interface does not deallocate the pages that were occupied by the deleted records. Rather, the transactional interface re-uses them as new records are inserted into the file (before allocating new pages).
If the final outcome of your calculations contains a fractional value, round the number to the next highest whole number.
To estimate the size of your file, perform the following steps:
For each key that does not allow duplicates or that allows repeating-duplicatable keys:
For each key that allows linked-duplicatable keys:
The B-tree index structure guarantees at least 50 percent usage of the index pages. Therefore, the index page calculations multiply the minimum number of index pages required by 2 to account for the maximum size.
Note
You can gain only a very rough estimate of the number of variable pages due to the difficulty in estimating the average number of records whose variable-length portion fit on the same page.
1 page for each alternate collating sequence page used (if any)
1 page for a referential integrity (RI) page if the file has RI constraints
This new sum represents the estimated total number of logical pages that the file will contain.
Every file has a minimum of two PAT pages; however, to calculate the number of PAT pages in a file, use one of the following formulas:
For pre-8.x file formats:
Number of PAT pages = ((Sum of pages in Steps 1 through 3) * 4) divided by ((Page size - 8 bytes for overhead) * 2)For 8.x or later file formats:
Number of PAT pages = ( (Sum of pages in Steps 1 through 3) * 6 ) divided by ( (Page size - 20 bytes for overhead) * 2 )
Size of the pool of unused pages = (Number of keys + 1)This formula applies if tasks execute Insert, Update, and Delete operations only outside transactions. If tasks are executing these operations inside transactions, multiply the average number of Insert, Update, and Delete operations expected in the transactions times the non-transactional figure determined by the formula. Similarly, you must further increase the estimated size of the pool of unused pages if tasks are executing simultaneous concurrent transactions.
|
Chapter contents
Prev topic: Choosing a Page Size
|