Skip to main content

Module index_cell

Module index_cell 

Source
Expand description

On-disk format for a single secondary-index entry.

Each entry maps one indexed value to the rowid of the table row carrying it. For the Phase 3e eager-load model we store one cell per (value, rowid) pair on TableLeaf-style pages that live in their own per-index B-Tree. The tree’s shape is identical to a table’s — same leaves, same sibling-chain, same interior pages — so all the 3d machinery carries over. The only thing different is the per-cell encoding, signalled by KIND_INDEX.

Encoding. Uses the shared [cell_length | kind_tag | body] prefix. The body mirrors a one-column local cell (so value-block helpers can be reused), except the rowid stored here is the original row’s rowid — the one the index entry points at.

  cell_length   varint          bytes after this field
  kind_tag      u8 = 0x04       (KIND_INDEX)
  rowid         zigzag varint   original row's rowid
  value_tag     u8              one of INTEGER/REAL/TEXT/BOOL
  value_body    variable        the indexed value

NULLs are never indexed (see SecondaryIndex::insert), so there’s no null bitmap — a non-null value is always present.

Structs§

IndexCell
One (value, rowid) pair stored in a per-index B-Tree.