Skip to content

ADR-0016 — No index on the run id

  • Status: Accepted
  • Date: 2026-11-12
  • Supersedes: none
  • Authors: project maintainers

Context

delete_for_runs matches the run_id key in checkpoint metadata. Upstream indexes only thread_id, so without an index of our own it reads every checkpoint to find the matching ones. Every index on upstream's checkpoints table adds a cost to every put.

Decision

We will not add an index on the run id. delete_for_runs is a rare maintenance call, so it reads every checkpoint.

Alternatives considered

  • An expression index on metadata->>'run_id' — rejected: on an uncontended host it made our put on a DeltaChannel graph 1.12× slower (p50 1.24 → 1.38 ms) and changed no other arm (measured before public release, with benchmarks/s4_run_index.py (removed before publication)). An earlier run on an IO-contended host is not quoted.

Consequences

  • delete_for_runs costs a scan of checkpoints; it is meant for maintenance, not a hot path.
  • The same index-cost measurement became the model for the listing index (ADR-0029).

References