Key Storage Requirements

Keys require storage space. The amount of space depends on the size of each key and on the number of keys that are defined.

For example, a CUSTOMER file requires two keys: one key defined by name, and another key defined by state, then city, with the following characteristics:

Key Length

Item-ID Length

Overhead

Total

20

5

3

28

2+12+1

5

3

23

If the file contained 100,000 items, the first key requires 2.8 MB of disk drive space or about 1500 frames (accounting for empty room at the end of the groups). The second key requires an additional 2.3 MB of disk drive space, or about 1250 frames.

The important point to note about key storage requirements is that the key values are stored twice, once in the main file and once in the key structure. Therefore, if space is tight, key only what is really needed and consider using the OCONV(###,"T1,##") function to store only the beginning several letters of a key thus making the keys smaller.

See Also

Using the BTREE File Structure System

BTREE File Structure

Interfacing with Applications

Defining Key Structures

Using Lookup and Browse Routines

Source Code to Lookup Routines

Maintaining Key File Performance

Optimizing Keys

Sizing Key Files

Stack Code Calculator Function

Estimating a Key's Location and File Size

Rebuilding Keys