Oracle 5.0 Reference Manual page 1298

Table of Contents

Advertisement

• Each index record contains a 6-byte header. The header is used to link together consecutive
records, and also in row-level locking.
• Records in the clustered index contain fields for all user-defined columns. In addition, there is a 6-
byte transaction ID field and a 7-byte roll pointer field.
• If no primary key was defined for a table, each clustered index record also contains a 6-byte row ID
field.
• Each secondary index record also contains all the primary key fields defined for the clustered index
key that are not in the secondary index.
• A record contains a pointer to each field of the record. If the total length of the fields in a record is
less than 128 bytes, the pointer is one byte; otherwise, two bytes. The array of these pointers is
called the record directory. The area where these pointers point is called the data part of the record.
• Internally,
stores fixed-length character columns such as
InnoDB
Before MySQL 5.0.3,
• An SQL
value reserves one or two bytes in the record directory. Besides that, an SQL
NULL
value reserves zero bytes in the data part of the record if stored in a variable length column. In
a fixed-length column, it reserves the fixed length of the column in the data part of the record.
Reserving the fixed space for
non-NULL
value to be done in place without causing fragmentation of the index page.
Rows in
tables that use
InnoDB
• Each index record contains a 5-byte header that may be preceded by a variable-length header. The
header is used to link together consecutive records, and also in row-level locking.
• The variable-length part of the record header contains a bit vector for indicating
number of columns in the index that can be
(For example, if there are anywhere from 9 to 15 columns that can be NULL, the bit vector uses two
bytes.) Columns that are
length part of the header also contains the lengths of variable-length columns. Each length takes one
or two bytes, depending on the maximum length of the column. If all columns in the index are
and have a fixed length, the record header has no variable-length part.
NULL
• For each
non-NULL
variable-length field, the record header contains the length of the column in
one or two bytes. Two bytes will only be needed if part of the column is stored externally in overflow
pages or the maximum length exceeds 255 bytes and the actual length exceeds 127 bytes. For an
externally stored column, the 2-byte length indicates the length of the internally stored part plus the
20-byte pointer to the externally stored part. The internal part is 768 bytes, so the length is 768+20.
The 20-byte pointer stores the true length of the column.
• The record header is followed by the data contents of the
• Records in the clustered index contain fields for all user-defined columns. In addition, there is a 6-
byte transaction ID field and a 7-byte roll pointer field.
• If no primary key was defined for a table, each clustered index record also contains a 6-byte row ID
field.
• Each secondary index record also contains all the primary key fields defined for the clustered index
key that are not in the secondary index. If any of these primary key fields are variable length, the
record header for each secondary index will have a variable-length part to record their lengths, even
if the secondary index is defined on fixed-length columns.
• Internally,
stores fixed-length, fixed-width character columns such as
InnoDB
length format. Before MySQL 5.0.3,
• Internally,
attempts to store UTF-8
InnoDB
(With
row format, such columns occupy 3 ×
REDUNDANT
Table and Index Structures
InnoDB
truncates trailing spaces from
InnoDB
values enables an update of the column from
NULL
row format have the following characteristics:
COMPACT
NULL
do not occupy space other than the bit in this vector. The variable-
NULL
InnoDB
CHAR(N)
1278
CHAR(10)
VARCHAR
is N, the bit vector occupies
non-NULL
truncates trailing spaces from
columns in
bytes by trimming trailing spaces.
N
bytes.) Reserving the minimum space
N
in a fixed-length format.
columns.
to a
NULL
columns. If the
NULL
CEILING(N/8)
columns.
in a fixed-
CHAR(10)
columns.
VARCHAR
NULL
bytes.
NOT
in
N

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents