Each row of data stored in a database has an address. In OceanBase Database, a ROWID data type stores the address of each row in the database.
ROWIDs apply to tables with and without primary keys. The universal ROWID (UROWID) data type can store both the foregoing types of ROWIDs.
In OceanBase Database, each table contains a pseudo column named ROWID.
A pseudo column functions as a normal column, but is not stored in a table. You can perform the SELECT operation on the pseudo column, but not the INSERT, UPDATE, or DELETE operation on the column values. A pseudo column is also similar to an SQL function without parameters. Typically, a function without parameters returns the same value for all rows in the result set, while a pseudo column returns different values for different rows.
A ROWID in a table with a primary key is obtained by performing Base64 encoding on the combination of generated columns of the primary key column and partitioning key in each row.
The values of a ROWID pseudo column correspond to the key for each row of data and are obtained after Base64 encoding. In a table with a primary key, the key is the primary key. In a table without a primary key, the key is a sequence automatically generated by the system. You can access the ROWID of each row by executing an SQL statement with the reserved ROWID field as the column name.
A ROWID in a table without a primary key consists of the tablet id and the hidden primary key column, which is then converted based on Base64 encoding. Both the tablet id and hidden primary key column can be represented by 64-bit integers. Therefore, a ROWID in a table without a primary key is at a fixed length.
You can access the ROWID of each row by executing an SQL statement with the reserved ROWID field as the column name.