System Architecture 2-135
Structure of an Index Page
Thebyte part of the index key value is as long as needed to contain the value
of the index key. If the indexed data is aVARCHAR data type, the calculated
lengthof the index key is the maximum length plus 1. The additional byte is
arequired-length byte, which precedes the VARCHAR data when it is stored
in the database. Therefore, the maximumVARCHAR that can be indexed is
254 bytes.
As an example of an index key value, consider row 101 in the table
stores5:customer.The lname value of row 101 is Pauli. The index key value
for thislname value is composed of a byte entry, Pauli, and a 4-byte rowid
entry for data row 101.
Iftwo or more rows share the same lname value, the rowid part of the index
keyvalue is a list of rowids for rows that share this key value. In this way,the
bytes part remains unique within the index.Figure 2-32 illustrates the
concept of the index key value.
When the first row of data is inserted into a table, the root node index page
receives one index key value and one 2-byte slot table entry. The root node
page serves as a leaf node page until it becomes full.
Figure2-32
Index key
values contain two
parts: a byte part
and one or more
rowids.
Index key values
rowid
rowid rowid
bytes
bytes
n30
3 07n