Skip to main content
Enterprise only
Lance provides _rowid and _rowaddr as row metadata rather than stored data columns. Both SQL fields have type UInt64. Select either column explicitly:
Output columns follow the order of the projection. _rowoffset and __row_id are unsupported SQL spellings.

Wildcards apply across the statement

A statement that does not reference row metadata keeps its ordinary SELECT * schema. Referencing _rowid or _rowaddr anywhere in a statement makes that column visible to wildcards throughout the same statement, including nested queries and joins:
Referencing _rowid alone does not expose _rowaddr, or vice versa. A later statement starts with the ordinary schema again. Statements that reference row metadata cannot use NATURAL JOIN, including references in wildcard modifiers or USING keys. Otherwise, the exposed metadata columns would become implicit join keys and could change which rows match. Use JOIN ON or JOIN USING with explicit keys instead.

Row identity and writes

_rowaddr identifies a physical row location and can change during compaction. _rowid remains stable across compaction only on tables created with stable row IDs enabled. Tables created through SQL default to stable row IDs disabled; on those tables, _rowid equals _rowaddr and can also change during compaction. Materialized views that read _rowid or _rowaddr rebuild fully on every refresh, including views that read _rowid from tables with stable row IDs enabled. Row metadata names cannot be written as data columns. INSERT, CREATE TABLE AS, and materialized-view definitions reject reserved output names. Use an ordinary alias when storing a metadata value:
The copied value is ordinary data; it does not acquire row identity semantics.

WAL tables and scan capacity

SQL projections and filters using _rowid or _rowaddr are rejected on WAL-backed tables. Rows in the fresh tier have no row identity equivalent. Metadata range predicates, such as _rowid > 0, can scan on the query node instead of using executors. Account for query-node capacity for large range queries. Direct row-ID lookups, such as _rowid = 42, are available when the desired IDs are known.