Skip to content

Post-commit index-adoption lag: ~1 s window where views are unindexed and every scan pays the O(novelty) range fallback #1758

Open

Description

@aaj3f

Found while attributing a p50 regression during #1732's measurement work (Claude traced and quantified it; spot-checked). Pre-existing, arm-invariant, and in the workload we measured it dominated everything else on the read path.

For roughly a second after every commit, fluree.db() serves unindexed views, and every scan against them pays the O(novelty) range fallback. The new index is adopted asynchronously after a commit; until adoption lands, views come back at db_t=0 with no binary index attached, so bound-subject point lookups that would normally be index seeks take the full range-scan fallback — ~6 ms per open at ~20k novelty flakes in our measurement, against ~10 µs for the same query against an indexed view.

How much it bites depends entirely on read-after-write density. In our probe (write bursts followed by read bursts — not an exotic shape), 1,071 of 1,600 opens (67%) landed on unindexed views, deterministically 153 of the first 200 queries after each commit. Any workload that reads soon after writing — which is most transactional workloads — spends its first post-commit second paying orders of magnitude over the indexed cost.

Worth saying explicitly: this is the same family as #1722/#1731 (post-write windows where derived state lags and reads degrade to novelty walks), but it's a distinct mechanism — not a cache keyed on a churning epoch, but the adoption gap between "index built" and "index served." The three compound in production: after a commit you can simultaneously pay the stats rebuild (#1731), and if you're inside the adoption window, the full range fallback on top.

Fix directions worth weighing (no strong preference, and the right answer may be "two of these"): serve the previous index during adoption rather than no index (readers see indexed-at-t-minus-1 plus novelty overlay — which is exactly what they see between index cycles anyway, so it's not a consistency change); make adoption synchronous-enough that the window closes with the commit for the common case; or at minimum expose the window observably (a span/counter) so operators can see when they're in it — today it's invisible, which is why it took a per-population split of span logs to find.

Evidence: interleaved dedicated-box runs, per-population split showing the delta lives entirely in the db_t=0 population with the indexed population byte-identical across arms; happy to attach the raw span logs.

Activity

  1. added
    P2
    area:query
    performance
    on Nov 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2area:queryperformance

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions