You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Query: a bound relationship variable doesn't drive its edge lookup #2237
When a relationship variable is already bound (from a VALUES seed, or an earlier pattern) and its endpoints
aren't, MATCH (s)-[r:K]->(o) plans as a scan of every K relationship per binding rather than a lookup of r's f:reifies* bundle. The same holds for startNode(r) / endNode(r). Instruction counts on 1,000 (:R)-[:K]->(:S) relationships (release, the #2184 harness):
Shape
Instructions
MATCH (a:R)-[r:K]->(b:S) RETURN a, b, r
100.6M
the same, also returning startNode(r), endNode(r)
1,024.3M
driver re-match of r's edge, r and both endpoints seeded (1,000 rows, SET r.v = 5 DELETE r)
837M
the same re-match with only r seeded
4,658M
#2184 avoids the slow shape for a relationship DELETE by seeding the re-match with the endpoints, which it
carries through the read clauses. It still takes the slow shape for a pattern read in either direction
(-[r:K]-), where no subject is known.
Plan:
Planner (fluree-db-query/src/planner.rs, the EdgeAnnotation arms): when the annotation variable is bound
before the pattern and the edge's subject/object aren't, plan it as subject lookups of the annotation's f:reifiesSubject / f:reifiesPredicate / f:reifiesObject facts that bind the edge, then a point check of
the base edge.
Evaluate startNode(r) / endNode(r) from the same bundle lookup.
Tests: a routing stamp (MustFire / MustNotFire) on the new plan, paired with a canary where the
annotation variable is unbound; twin SPARQL (<< ?s ?p ?o >>-style annotation reads) and JSON-LD reads
where the shared IR reaches them.
Perf: the four rows above, plus query_scan_warm and the CI compare benches, which must not move.
Activity