Skip to main content

Module query_optimizer

Module query_optimizer 

Source
Expand description

Rule-based and cost-aware operator-tree optimizer.

Walks an OperatorTree and applies the ten rewrite stages from Theorem 6.1.2 (Paper 1) and Theorem 6.1.1 (Paper 2):

  1. simplify_algebra – address-independent idempotence / absorption / empty elimination on membership-only Intersect / Union operands. Score-bearing operands remain distinct because posting-list merges add their scores.
  2. push_filters_down – sink Filter into Intersect children when the field applies.
  3. push_graph_pattern_filters – fold vertex / edge property filters into PatternMatch constraints.
  4. push_filter_into_traverse – absorb vertex predicates into Traverse so BFS prunes during expansion.
  5. push_filter_below_graph_join – move filters past graph joins when the field belongs to the left side.
  6. fuse_join_pattern – merge intersected PatternMatch operators that share a vertex variable.
  7. merge_vector_thresholds – collapse adjacent VectorSimilarity(q, t1) AND VectorSimilarity(q, t2) into a single VectorSimilarity(q, max(t1, t2)).
  8. reorder_intersect – sort Intersect children by estimated cardinality (cheapest first).
  9. reorder_fusion_signals – sort fusion signals by cost; graph operators receive a 0.5x discount when graph stats are available.
  10. apply_index_scan – substitute leaf Filter with IndexScan when a covering index is registered and cheaper.

Structs§

IndexScanCandidate
Query-local physical index candidate supplied by an engine catalog.
OptimizerConfig
Fluent configuration for the optimizer pipeline. Lets callers disable individual stages for testing without poking at private fields.
QueryOptimizer
Operator-tree query optimizer.