Index entries
Index entries use first bytes 0x02, 0x03 and 0x06, see the keyspace map. In the rules below, pk_enc is the encoded primary key of the row.
Unique index
Section titled “Unique index”Applies when no key column is NULL. Key: 0x03 ‖ index_id u32 BE ‖ encoded index cols.
| Index | Value |
|---|---|
| no INCLUDE columns | pk_enc |
| with INCLUDE columns | varint len(pk_enc) ‖ pk_enc ‖ row-format(include values) |
The include values use the row format. The INCLUDE columns are named in Ext I: INCLUDE columns.
Non-unique index
Section titled “Non-unique index”Key: 0x02 ‖ index_id u32 BE ‖ encoded index cols ‖ encoded pk. The primary key is part of the key.
The value is empty, or row-format(include values) when the index has INCLUDE columns.
A unique index entry whose key columns contain a NULL is stored the same way as a non-unique entry, with the primary key in the key (SPEC V72).
JSON-path index
Section titled “JSON-path index”Key: 0x06 ‖ index_id u32 BE ‖ encoded scalar ‖ encoded pk. There is one entry per extracted scalar, and the value is empty.
Column encoding
Section titled “Column encoding”Index columns and scalars are written with the order-preserving encoding.