Skip to content

Late decoding for a default graph of several graphs of one ledger #2015

Description

@bplatz

Since #2004, a default graph made of ≥2 graphs of one ledger (the union default graph, or FROM naming several of a ledger's graphs) scans each member with eager materialization (DatasetOperator::member_ctx_for). A GRAPH scope also decodes every encoded binding it hands to such a scope (ScopeExit in graph.rs). This fixed a cross product: the multi-graph scope has no graph view, so join substitution left EncodedSid bindings unbound.

Cost: every row decodes subject IRIs and literals as it is scanned. That includes count- and group-only queries, which used to keep IDs encoded through to output.

Possible fix: only NUM_BIG handles are per-graph. Give the multi-graph scope a decode-only view (any member's) for the decoding sites to use, while has_binary_store() stays false so the single-graph fast paths remain off. Members would then eagerly decode NUM_BIG only. Roughly 38 graph_view() call sites in fluree-db-query would need to decide whether to use it.

Measure first: compare eager and late decoding on an indexed ledger over FROM <L> FROM <L#g> (or with the union on), for a count/group query and a join query. Only build this if the gap is material.

Acceptance:

  • joins_over_several_graphs_of_an_indexed_ledger stays green.
  • A new test shows NUM_BIG values from different members decoding against their own graph's arena.

Activity

  1. added
    P3Backlog: valid, low payoff-per-effort
    area:queryQuery execution, planning, fast paths, overlay, result formatting
    on Oct 3, 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

    P3Backlog: valid, low payoff-per-effortarea:queryQuery execution, planning, fast paths, overlay, result formatting

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions