Repository navigation
Description
Goal
Track the remaining CSR storage and traversal work, with Lance staying the source of truth and the CSR staying a derived index on a single machine.
With persist_csr=True, engines can load a usable stored CSR instead of rebuilding it at start-up (#109). The CSR is still loaded whole into memory. Node indexes are still built at start-up, alongside the stored CSRs, which load in parallel since #155 (#117). Named relationship hops already stay on the CSR and use stored edge row addresses (#87).
Most of these ideas come from lance-graph's CSR roadmap (lance-format/lance-graph#159) and the review of its native expand PR (lance-format/lance-graph#162).
Open work
- Build the CSR as a native Lance adjacency index #81: build the CSR as a native Lance adjacency index (Stage 3 of Persist the CSR so engines skip the build at start-up #72). Tracked as blocked on Lance's pluggable index support.
Completed or split out
- Store node indexes so engines skip the scan at start-up #117: store node indexes so engines skip the node-table scan at start-up. Closed by perf(csr): load stored csrs in parallel at engine start #155 without storing them: on GDC SF1 read lazily, node indexes took 62 ms of a 458 ms start and loading the stored CSRs took 393 ms. perf(csr): load stored csrs in parallel at engine start #155 loads the CSRs in parallel and builds node indexes at the same time, which cut that start to 109 to 122 ms, at about 0.15 GiB more peak memory.
- Shrink the CSR's per-node map and neighbours #79: shrink the CSR's per-node map and neighbours. Done for the map in perf(csr): shrink the csr's per-source index #159: on SF1 the source index fell from 444.7 to 92.6 MiB and the CSR from 776.9 to 417.1 MiB, with each direction choosing a hash map of ranges or, for large many-to-one directions with clustered ids, a bitmap per run of 64 keys. Neighbours are unchanged; Pass node row numbers between CSR hops instead of ids #160 proposed shrinking them and was closed as not planned.
- Persist the CSR so engines skip the build at start-up #72: persist the CSR so engines skip the build at start-up. Done for the CSR in feat(csr)!: store the csr inside each lance dataset and pack edge rows #109. Node-index persistence is Store node indexes so engines skip the scan at start-up #117; native Lance index integration is Build the CSR as a native Lance adjacency index #81.
- Store an edge row address in each CSR slot #73: store an edge row address in each CSR slot. Done in feat(csr)!: keep named relationships on the csr with edge rows #87. This supports relationship-property lookup and separate edge occurrences; it does not by itself implement cross-hop edge predicates in variable-length paths.
- Report CSR freshness in Lance index terms and add an optimize step #75: report CSR freshness in Lance index terms and add an optimize step. Done: reporting in feat(csr): report how far the base csr trails the data #93, the optimize step in feat(csr): fold the delta into a new base with optimize_csr() #98.
- Expand multi-hop patterns without materializing every intermediate row #78: avoid materializing every intermediate row in multi-hop patterns. Closed as a split tracker, not as completion of general factorized execution. Its follow-ups Pass neighbour lists between CSR hops instead of one row per match #134 and Push count(*) below the joins for paths of three or more hops #135 were later closed without being built (see Decisions); Count two-hop patterns grouped by a node from degrees #136 and Late-materialize a grouped node's properties from Lance node tables #99 are complete.
- Run shortestPath from many sources with multi-source BFS #76: multi-source BFS for
shortestPathfrom many sources. Done in perf(query): search shortest paths from many sources together #153. The forward searches of an input batch run together, up to 64 sources at a time, sharing neighbour reads and per-node state; every shortest path, tie and parallel edge is kept. Shortest paths between many bound endpoint pairs ran 3x to 8x faster with up to 25x less peak memory on the targeted workloads, and both benchmark suites stayed within noise. A source with one target keeps bidirectional search when incoming adjacency is available. Not included: batches wider than 64 sources, memory accounting for the operator, and a cost-based choice between batched and bidirectional search for single targets. - Count two-hop patterns grouped by a node from degrees #136: grouped two-hop counts. Done in perf(planner): count grouped two-hop paths from degrees #150. Counts grouped by the middle node or either outer node's id/direct properties use per-node counts and weighted sums. Eligibility still requires a unique integer middle-node index, hop-local predicates and sufficient estimated fan-out. A grouped outer node bound to one id keeps the selective walk. Grouped optional matches, distinct counts, nullable-property counts, computed grouping expressions and grouping across nodes retain their existing plans.
- Late-materialize a grouped node's properties from Lance node tables #99: late materialization of grouped node properties from Lance tables. Done in perf(planner): look up grouped node columns from lance tables #140. Eligible plans carry ids through grouping and fetch the other properties afterwards.
Earlier count steps remain relevant: #97 introduced scalar two-hop counts; #113 added in-place CSR degree counting and first-hop aggregation; #131, #132 and #133 extended scalar counting to shared-end, undirected and optional shapes respectively. These are targeted rewrites, not a general factorized execution model.
Decisions
- Pass node row numbers between CSR hops instead of ids #160: pass node row numbers between CSR hops instead of ids. Closed as not planned: it would break the guarantee that node-table writes never touch the CSR, and its estimated saving on SF1 was about 100 MiB net. Its closing comment records the reasons and an untested alternative, dictionary-encoded neighbours (about 80 MiB estimated).
- Pass neighbour lists between CSR hops instead of one row per match #134: pass neighbour lists between CSR hops instead of one row per match. Closed as not planned. Explore FFX-style packed factorized execution for multi-hop CSR #105 found no workload in the current benchmarks limited by intermediate size.
- Push count(*) below the joins for paths of three or more hops #135: count paths of three or more hops. Deferred, not done: closed until a wider variety of query patterns and a real use case call for it.
- Look up CSR neighbours with async, batched calls #74: async, batched neighbour lookups. Closed as not planned: the CSR is loaded whole into memory, so this is not needed by the current storage design. Revisit if partial or disk-backed loading becomes a goal.
- Evaluate icebug-format as the persisted CSR layout #77: evaluate icebug-format as the persisted CSR layout. Decided against: its dense node positions conflict with the raw-key layout used here.
Related changes
- IC5 is about 20% slower in memory mode since named hops moved to the CSR #92: IC5's memory-mode slowdown after named hops moved onto the CSR. Closed after perf(csr): filter in-memory relationship columns per chunk #100 and perf(planner): look up a grouped node's columns after grouping by id #101, as recorded in its closing comparison.
- feat(mapping)!: allow relationships without a record key #151:
GraphMappingnow allows relationship tables without a record key.EdgeTableMapping.keyis optional; node keys remain required. This removes a descriptor requirement for endpoint-only tables. It changes neither query execution nor CSR storage or relationship-reuse semantics, so it does not complete another item above. Rust callers constructing mappings with a key must wrap it inSome(...).
Each open sub-issue describes its own problem and acceptance criteria. Performance claims still require measurements against main on both benchmark suites, following CONTRIBUTING.md.
Status refreshed November 13, 2026, after #150, #151 and #153 merged. The #76 figures come from the measurements in #153; the rest is a status/source review, not a new benchmark run.
Activity
prrao87 commentedon Nov 14, 2026
Closing this tracker. Everything it listed is done, decided or deferred, as recorded above. The one item still open is #81: build the CSR as a native Lance adjacency index, blocked on Lance supporting pluggable index kinds. (#160, the remaining memory work from #79, was later closed as not planned; see Decisions.)