Skip to content

Sequential writes: a routed statement over many rows still costs more than one Txn #2236

Open

Description

@aaj3f

A multi-clause write routed to the sequential driver costs 1.07× the single Txn at 1,000 rows (two SETs of one
key; instruction counts in #2184's body), and SPARQL's ;-separated updates pay the same per-operation overhead
on main. After #2184 (stats pinned once per write, no state built after the last operation, FxHash fold) the
remaining overhead is the per-operation work in SequentialStager (fluree-db-api/src/tx.rs): each operation's
stage() builds a staged view over the virtual state, the stager then takes it apart to fold its flakes, and
applies them to the next virtual state.

Plan:

  1. Give stage() a mode that returns an operation's flakes, namespace delta and graph delta without building the
    StagedLedger view, for callers that fold the flakes themselves; SequentialStager::stage uses it for every
    operation.
  2. Apply each operation's folded flakes to the virtual state once (the stager already does the apply; drop the
    view build that precedes it).
  3. Measure with the instruction-count harness: set_set_all, remove_set_all, sparql_multi, merge_chain,
    and the single-Txn controls (set_one_clause_all, jsonld_upsert) to show they don't move. Target: the
    routed 1,000-row rows at or under 1.0× the single Txn.

Raised in review of #2184.

Activity

  1. added
    enhancement
    P3
    area:transact
    on Nov 2, 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:transactenhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions