Neoview SQL Reference Manual (R2.3)
Keys
Neoview SQL supports these types of keys:
• “Clustering Keys”
• “Index Keys”
• “Primary Keys”
Clustering Keys
Neoview SQL organizes records of a table or index by using a b-tree based on the “clustering
key”. Values of the clustering key act as logical row-ids. The primary key is the clustering key
and it must be unique.
Index Keys
There is always a one-to-one correspondence between index rows and base table rows.
Each row in a Neoview SQL index contains:
• The columns specified in the CREATE INDEX statement
• The clustering (primary) key of the underlying table (the user-defined clustering key)
For a unique index, the clustering key of the index is composed of the first of these items. The
clustering key of the index cannot exceed 2048 bytes, but the entire row (including the clustering
key of the index) can contain up to 510 bytes.
For a nonunique index, the clustering key of the index is composed of both items. The clustering
key cannot exceed 2048 bytes. Because the clustering key includes all the columns in the table,
each row is also limited to 2048 bytes.
For varying-length character columns, the length referred to in these byte limits is the defined
column length, not the stored length. (The stored length is the expanded length, which includes
two extra bytes for storing the data length of the item.)
See “CREATE INDEX Statement” (page 58).
Primary Keys
A primary key is the column or set of columns that define the uniqueness constraint for a table.
The columns cannot contain nulls, and there is only one primary key constraint on a table.
232 SQL Language Elements