Previous Topic: Data Records

Next Topic: RID Reuse

Record ID

Each record in an NDB is assigned a Record ID (RID), which is unique identifier of a logical record in an NDB.

Note: All dynamic data NDBs do not require reorganization to reclaim free space.

The RID is assigned by the Database Manager, when a record is added to an NDB. The RID is a number, from 1 to 1 billion (actually, 2**30 - 1), that uniquely identifies this record in the NDB. All internal access to a record is made by providing the RID. The RID assigned to a record never changes, and (currently) is not reassigned to another record when a record is deleted.

Note: The RID cannot be assigned by the user. The assigned value is made available to the NCL process that inserts a record via the &NDBRID system variable.

The RID is necessary, as an NDB does not need to have a sequence key (or any key, for that matter), and a way of uniquely identifying a record is always required.

Whenever a record is retrieved by an &NDBGET NCL statement, the RID of that record is returned in &NDBRID. The record could have been retrieved by a key, or from an &NDBSCAN result list, but the RID is always made available, so that a following &NDBUPD or &NDBDEL statement can refer to the correct record.