Skip to content

Every posting list has a prefix, and every entry that belongs to the list is a key under that prefix. The first byte is the keyspace tag: 0x04 for trigram lists and 0x05 for full-text lists (crates/strata-sql/src/postings.rs).

list prefix = tag ‖ index_id u32 BE ‖ sub u8 ‖ term_len u8 ‖ term utf8
Field Encoding Meaning
tag u8 0x04 trigram or 0x05 full-text
index_id u32 big-endian The id of the index, see Index definition
sub u8 Which sub-key family follows (table below)
term_len u8 Length of the term in bytes
term UTF-8 The term: a trigram or a full-text token
sub Name Key continues with Value
0x00 BLOCKS the last primary key of the block, or the single byte 0xFF for the open tail block a posting block
0x01 PENDING (start_ts+1) u64 BE then the primary key live u8 (1 live, 0 delete), zvarint d0, zvarint d1, then the payload (empty when live is 0)
0x02 DIR nothing block directory, see below
0x04 WATERMARK nothing u64 mark (8 bytes, legacy) or 3 times u64 (24 bytes: mark, writer instance, sequence), all little-endian
0x05 STATS nothing 2 times i64 LE
0x06 SWEPT nothing (the term is empty, term_len 0) u64 LE instance id of the process that finished a sweep

sub values 0x03 and above 0x06 are not used.

The DIR value is varint count, then per block: varint shared ‖ varint unshared ‖ suffix (the block key, front-coded against the previous block key), varint len (entries in the block), u64 LE stamp, u8 tiers (at most 4) and tiers pairs of varints a and b. Block keys must be strictly ascending and the value must end exactly after the last block.

The primary key in a BLOCKS key is the encoded primary key of the row, see Table rows. Because it is the last key of the block, blocks of one list sort in primary-key order, and the open tail block (0xFF) sorts last.

PENDING entries use start_ts+1 as a big-endian u64; d0 and d1 are zvarints.