The authoritative index architecture — the CDX logical container and the LMDB-backed order environment — is documented in CDX and LMDB Indexing. This page summarizes the rules that keep ordering deterministic and rebuilds stable.
Key expression and tags
- An index tag is built from a key expression over one or more fields
(
INDEX ON <expr> TAG <name>). - A CDX container holds one or more named tags;
SET ORDER TO <tag>selects the active logical order for navigation andSEEK. - The logical order is served from the LMDB index environment, not by scanning and sorting the DBF.
Deterministic ordering
- Keys are normalized before comparison so the same input always sorts the same way (consistent collation and comparison rules).
- Duplicate keys are ordered stably;
SEEKlands on the first matching record in the active direction (ASCEND/DESCEND). SEEKon the active tag uses an LMDB keyed range-seek (O(log n)), and the landed record is re-verified against the DBF before it is accepted.
Maintenance
REINDEXis the canonical rebuild dispatcher (INX, CNX, CDX/LMDB, and student index families), choosing a default family by table flavor.BUILDLMDBbuilds or rebuilds the LMDB backing store for a CDX container.- After a buffered
COMMITor crash recovery, an indexed table needs aREINDEX—COMMITdoes not do incremental CDX/LMDB maintenance.