Browse the documentation

Indexes

Expression indexes, index lifecycle and how the planner uses them.

Create an index

Declare indexes with expression selectors - single fields, nested fields and compound keys:

orders.CreateIndex(x => x.Country);                       // single field
orders.CreateIndex(x => x.ShippingAddress!.City);         // nested field
orders.CreateIndex(x => new { x.Country, x.Status });     // compound key

The planner uses an index when a filter matches it; query explanation shows which index answered a query and which were refused, and why. Full-text and vector indexes are covered on their own pages.

Index lifecycle

Every index - scalar, vector or full-text - is a versioned generation tied to a checkpoint, with an explicit lifecycle. If maintenance fails, the index is marked degraded, and the degradation survives a restart. The planner never uses an index that is not ready, so answers stay correct at the cost of a scan until it is rebuilt. Building an index does not hold the collection still.

The lifecycle of an index and how the planner treats each state Building Ready Degradedsurvives a restart Rebuildingfull, in the background maintenance fails checkpoint mismatch Query planner Ready: the index answers any other state: scan fallback, slower, never wrong Every index is a versioned generation tied to a checkpoint. Building one does not hold the collection still.
The index lifecycle. Only a ready index answers queries; in every other state the planner scans, which is slower but never wrong.

Things to know

  • Range queries over a sorted index iterate linearly: correct, not fast.
  • The planner chooses a single index with a scoring heuristic; it has no cost model.
  • There is no online incremental index build: a checkpoint mismatch triggers a full background rebuild, served by scan fallback meanwhile.
  • Index definitions are not logged in the WAL; they are derived state, reconstructed and checkpoint-verified.
An unhandled error has occurred. Reload X

Reconnecting

Restoring the connection to the server...

Still trying

Next attempt in seconds

Connection lost

We could not reach the server.