By default in a v7.0 or later file, the transactional database engine stores duplicatable keys as linked-duplicatable keys. When the first record with a duplicate key value is inserted into a file, the transactional database engine stores the key value on an index page. The transactional database engine also initializes two pointers to identify the first and last record with this key value. Additionally, the transactional database engine stores a pair of pointers at the end of the record on the data page. These pointers identify the previous and next record with the same key value. When you create a file, you can reserve pointers for use in creating linked-duplicatable keys in the future.
If no room is available to create a linked-duplicatable key (that is, if no duplicate pointers are available), the transactional database engine creates a repeating-duplicatable key. The transactional database engine stores every key value of a repeating-duplicatable key both on a data page and on an index page. In other words, the key’s value resides in the record on a data page and is repeated in the key entry on an index page.
Files that use the 5.x format use this same key flag (called the
supplemental key attribute in 5.
x) to designate that a key was created with the 5.
x Create Supplemental Index operation (31).
Preallocation guarantees that disk space is available when the transactional database engine needs it. The transactional database engine allows you to preallocate up to 65,535 pages to a file when you create a data file. Table
26 shows the maximum number of
bytes the transactional database engine allocates for a file of each possible page size (assuming you allocate 65,535 full pages of disk space):
The speed of file operations can be enhanced if a data file occupies a contiguous area on the disk. The increase in speed is most noticeable on very large files. To preallocate contiguous disk space for a file, the device on which you are creating the file must have the required number of bytes of contiguous free space available. The transactional database engine preallocates the number of pages you specify, whether or not the space on the disk is contiguous.
When you issue an API Stat operation (15), the transactional database engine returns the difference between the number of pages you allocated at the time you created the file and the number of pages that the transactional database engine currently has in use. This number is always less than the number of pages you specify for preallocation because the transactional database engine considers a certain number of pages to be in use when a file is created, even if you have not inserted any records.
The transactional database engine allows you to further conserve disk space by employing index balancing. By default, the transactional database engine does not use index balancing, so that each time a current index page is filled, the transactional database engine must create a new index page. When index balancing is active, the transactional database engine can frequently avoid creating a new index page each time a current index page is filled. Index balancing forces the transactional database engine to look for available space on adjoining index pages. If space is available on one of those pages, the transactional database engine moves keys from the full index page to the page with free space.