For each key defined, a complete and independent index is constructed which consists of a tree of index node records. Each index node record contains actual key values associated with data records written to the indexed file. Every key value in a node will point either to a subordinate index node record or, if it is a leaf node, to the data record associated with the key.
The top level node record is called the root.
The default node size is 1024 bytes, but can change depending on the largest key size defined for the file. If the largest key is greater than 238 bytes, the node size will be 4096 bytes.
注意: It is possible to change the default node size by setting the XFHNODE environment variable to one of 512, 1024 (the default) or 4096 bytes. However, if you set XFHNODE to 512 and the largest key value is greater than 120 bytes, the value of XFHNODE will be overwritten by 1024. Also, if you set XFHNODE to 512 or 1024 and the largest key value is greater than 248, the value of XFHNODE will be overwritten by 4096. The setting of XFHNODE is only effective at the time that the file is created - you cannot alter the node size of an existing file.
The index node record contains:
Size | Description of the field | ||||
---|---|---|---|---|---|
2 |
| ||||
n | Key value block | ||||
... | |||||
n | Key value block | ||||
1 | Index number.
The value is the same for all nodes belonging to the same index tree. Contains zero if this is the primary key. | ||||
1 |
|
The key value block contains:
Size | Description of the field | ||||
---|---|---|---|---|---|
1 | Present only when compression of leading characters is enabled. Contains a count of leading characters identical to those in the previous key. It will always be 0 for the first key in a node. | ||||
1 | Present only when compression of trailing spaces is enabled. Contains a count of trailing spaces for this key value. | ||||
n | Key value. | ||||
duplicate-occurrence | Optional. Duplicate occurrence number. See the topic Types of Indexed File for details. This field is present only if duplicates are allowed for this key. It contains the duplicate occurrence count. The first key stored that is a duplicate has this field set to 1. Second duplicate has this field set to 2, and so on. | ||||
file-pointer-size |
|