Skip to content

[bench] Time-travel and multi-ledger DataSetDb history query coverage #1233

Open

Description

@aaj3f

Status (checked on main at f42ea37, 2026-11-14)

Two benches added since cover part of this:

  • fluree-db-api/benches/query_time_travel_below_index.rs (2fffd49) times a read as of a t that the index covers, with unindexed commits after it.
  • fluree-db-api/benches/dataset_build.rs (d53cad0) times building and querying datasets whose members are graphs of one ledger or separate ledgers.

Still missing:

  • The history-depth curve: a query at t-1 against one at t/2, to catch time travel that grows quadratically with history depth.
  • DataSetDb history-range queries across two ledgers. Neither bench above runs a history-range query.

Original description

Context

Follow-up bench(es) from PR #1228 review (coverage gaps #6 and #7). The Query API has a rich layering — query_connection, db()/db_at_t()/db_at(), DataSetDb, multi-ledger history queries — and none of the new benches in PR #1228 exercise the time-aware or multi-ledger paths. A regression in the time-travel materialization path or in DataSetDb's history range queries would slip through both query_hot_bsbm (single-ledger, head-only) and query_cold_reload (cold load, no time-travel).

Bundling these two coverage gaps into one issue (and likely one PR) because they share fixtures (a populated ledger with multiple commits at distinct t values), share API patterns (the at_t family of accessors), and share the "this is API-surface coverage rather than a single hot-path bench" character.

Scope

Add two scenarios under fluree-db-api/benches/ (single-file or two-file, author's call):

  • query_time_travel.rs — exercises fluree.graph_at(id, TimeSpec::T(...)) (or equivalent db_at_t) against a populated ledger with N committed transactions. Two scale-driven scenarios:
    • query_at_recent_t — query at t-1 (one txn back); should be fast.
    • query_at_old_t — query at t/2 (halfway-back); should still be reasonable. Establishes the latency curve so a regression that makes time-travel materialization quadratic-in-history-depth is caught.
  • query_multi_ledger_history.rs — exercises DataSetDb history-range queries across two ledgers. Single scenario at first (just exercise the path); add scale dimensions if the budget allows.

Each:

  • Use the chassis pattern. bench_runtime(), current_profile(), current_scale(), next_ledger_alias().
  • Deterministic data via gen::people (commit one txn per t step).
  • Register budgets in regression-budget.json for both crate/bench pairs.

Acceptance

  • Both benches compile and run --test green at tiny scale.
  • regression-budget.json has entries for both.
  • BENCHMARKING.md's table grows two rows (or one row if the author bundles both into a single bench file with two scenarios).
  • Bench-gate CI job picks them up.

References

Out of scope

merge, rebase, and branching benches — those are user-facing operations rather than hot-path query reads. If a future regression hunt cares about merge perf, that's a separate issue.

Activity

  1. added
    P3
    area:query
    on Aug 25, 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

    P3area:query

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions