SQL/MP Installation and Management Guide

Understanding and Planning Database Tables
HP NonStop SQL/MP Installation and Management Guide523353-004
3-11
Relative File Structure
position in the file. The first record is identified by record number zero. Succeeding
records are identified by ascending record numbers in increments of one.
The value of the primary key is either a user-specified or system-generated relative
record number. Each new row is stored at the relative record number specified by the
primary key.
Figure 3-3 illustrates the structure of a relative file.
Each physical record position in a relative file occupies a fixed amount of space, and
each position can contain one variable-length data record (logical record). A logical
record can vary in size from zero, an empty record, to the maximum record size
specified when the file was created.
You can change a record’s logical length after it has been written to the file, but the
lengths of all logical records in the file must always be less than or equal to the
constant size of the physical record. Each logical record has a length attribute that can
be returned when a record is read. Logical records in a relative file can be logically
deleted, resulting in logical records of length zero.
After you have created the file and written a data record to it, all physical records
preceding that record are also created and actually occupy space on the disk, although
they contain no data. For example, if you create a relative file and then write a data
record to record number 135, records 0 through 134 are also physically created on the
disk at that time, although they have a logical record length of zero. Note that this
Figure 3-3. Relative File Structure
Data
Blocks
Record 0 Record 1 Record 2 Record 3
Data DataDataEmpty
Empty
VST004.vsd
Each record has a length
attribute. Therefore, the data
portion (logical record) can vary
within the physical record
Fixed-length physical records.
Each record position occupies
a fixed amount of space even
if the record contains no data.