Repository navigation
Description
Summary
On LSQB SF1, query Q9 is the only one of the nine queries that runs faster without the Graph Analytical View (OLTP) than with it (OLAP). Every other query is 23-98x faster with the GAV. Q9 is also about 25x slower than LadybugDB (0.07 s), so it is the one place where ArcadeDB's planner or the GAV operators leave a large gap.
Numbers on 26.10.1 (embedded, warm: first call discarded, median of 3 timed runs, median of 3 JVM launches; MacBook M5 Pro, Temurin 25, -Xms12g -Xmx12g -XX:+UseCompactObjectHeaders; LSQB SF1, 3,947,829 vertices, 17,882,623 edges; count 1,596,153,418 is correct in both modes):
| Q9 | |
|---|---|
| OLAP (GAV) | 1.78 s |
| OLTP (no GAV) | 0.90 s |
| ArcadeDB Docker server (GAV) | 2.32 s |
| LadybugDB | 0.07 s |
| DuckDB | 6.03 s |
For comparison, on Q6 (the same pattern without the anti-join) OLAP takes 0.13 s and OLTP 12.77 s.
What Q9 does
MATCH (p1:Person)-[:KNOWS]-(p2:Person)-[:KNOWS]-(p3:Person)-[:HAS_INTEREST]->(t:Tag)
WHERE NOT (p1)-[:KNOWS]-(p3) AND p1 <> p3
RETURN count(*) AS countIt is a two-hop friend-of-friend pattern (undirected KNOWS twice) followed by one HAS_INTEREST expansion, with an anti-pattern: p1 and p3 must not already be friends. It counts every (p1, p2, p3, tag) combination, 1.6 billion rows, so the answer is a count and the cost is in how the engine produces and filters the intermediate rows.
Q6 is the same query without the NOT (p1)-[:KNOWS]-(p3) part, and there the GAV is 98x faster than OLTP.
Reproduce
Repository: https://github.com/ArcadeData/ldbc_graphalytics_platforms_arcadedb
python3 datasets.py download lsqb-sf1
cd lsqb
LDBC_JAR=../target/graphalytics-platforms-arcadedb-0.1-SNAPSHOT-default.jar
javac -cp "$LDBC_JAR" ArcadeDBEmbeddedLSQB.java
java -Xms12g -Xmx12g --add-modules jdk.incubator.vector -XX:+UseCompactObjectHeaders -cp ".:$LDBC_JAR" ArcadeDBEmbeddedLSQB # OLAP, Q9
java -Xms12g -Xmx12g --add-modules jdk.incubator.vector -XX:+UseCompactObjectHeaders -cp ".:$LDBC_JAR" ArcadeDBEmbeddedLSQB --no-gav # OLTP, Q9Why OLTP is faster: hypothesis, not yet verified
I have not run EXPLAIN or PROFILE on Q9 in both modes yet, so what follows is from reading the engine source (the GAV operators GAVExpandAll, GAVFusedChainOperator, GAVExpandInto) and is only a hypothesis:
- With the GAV, the anti-join
NOT (p1)-[:KNOWS]-(p3)is probably planned as an expand-into / anti-semi-join per candidate row after the whole 1.6-billion-row two-hop-plus-interest expansion has been produced, while the OLTP plan may filter earlier or in a different order. - The fused chain operator is a big win when the pattern is a pure chain (Q6 at 0.13 s), but the anti-pattern may break the fusion and fall back to a slower path for part of the plan.
Suggested next steps
- Run
PROFILEfor Q9 with and without the GAV and compare the operator trees and row counts per operator. - If the anti-pattern breaks the fused chain, plan it as an anti-join on the CSR adjacency (sorted neighbour lists allow a merge or binary-search membership test instead of a per-row lookup).
- Consider evaluating the anti-join before the
HAS_INTERESTexpansion: it only depends onp1andp3, so it can be applied before the 1.6-billion-row fan-out over tags.
Raw logs and the full tables: results-multivendor-validated-2026-10-05.md in the repository above.
Activity
test: hub vertex covers the binary-search intersection; unambiguous m…
perf: build each merged neighbour view once under concurrency (#9282)
docs: state the sorted-range contract of NeighborView and the livenes…
test: merged neighbour views are sorted per node (#9282)
Merge pull request #9284 from ArcadeData/fix/9282-lsqb-q9-anti-join
lvca commentedon Oct 6, 2026
Fixed in #9284.
Q9 already used the count push-down, but through the Graph Analytical View it built every anchor's full friend-of-friend list before applying the anti-join. It now counts those paths directly from the sorted adjacency lists, and undirected neighbour lists are built once per view instead of on every query. On a synthetic 20K-person graph Q9 went from 167 ms to 38 ms with the same result (I did not run LSQB SF1 itself).
While testing I also fixed a related bug: through the view, a bare
WHERE NOT (a)-[:T]-(c)(withouta <> c) returned 0 or far too few rows.One separate problem was found and filed as #9283: counts over an undirected hop count a self-loop twice.
❤️ Thanks for helping make ArcadeDB better! ArcadeDB is free and open source, sustained by its community. If it's useful to you or your company, please consider becoming a sponsor to keep development going.
perf: count LSQB Q9-style anti-join chains algebraically and cache me…