17.10 - Row Hash and RowID - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL Fundamentals

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Release Date
July 2021
Content Type
Programming Reference
Publication ID
B035-1141-171K
Language
English (United States)

Database table rows are self-indexing with respect to their primary index and so require no additional storage space. When a row is inserted into a table, Vantage stores the 32-bit row hash value of the primary index with it.

Because row hash values are not necessarily unique, Vantage also generates a unique 32-bit numeric value (called the Uniqueness Value) that it appends to the row hash value, forming a unique RowID. This RowID makes each row in a table uniquely identifiable and ensures that hash collisions do not occur.

If a table is defined with a partitioned primary index (PPI), the RowID also includes the combined partition number to which the row is assigned, where the combined partition number is derived from the partition numbers for each level of the PPI.

For tables with no PPI … For tables with a PPI …
The first row having a specific row hash value is always assigned a uniqueness value of 1, which becomes the current high uniqueness value. Each time another row having the same row hash value is inserted, the current high value increments by 1, and that value is assigned to the row. The first row having a specific combined partition number and row hash value is always assigned a uniqueness value of 1, which becomes the highest current uniqueness value. Each time another row having the same combined partition number and row hash value is inserted, the current high value increments by 1, and that value is assigned to the row.
Table rows having the same row hash value are stored on disk sorted in the ascending order of RowID.

Uniqueness values are not reused except for the special case in which the highest valued row within a row hash is deleted from a table.

Table rows having the same combined partition number and row hash value are stored on disk sorted in the ascending order of RowID.

Uniqueness values are not reused except for the special case in which the highest valued row within a combined partition number and row hash is deleted from a table.

A RowID for a row might change, for instance, when a primary index or partitioning column is changed, or when there is complex update of the table.