Skip to main content

Crate uqa_planner

Crate uqa_planner 

Source
Expand description

Query optimizer: cost estimation, cardinality, join enumeration.

The planner is organized into these modules:

  • cost_model – per-operator cost model. Estimates a unitless cost for scans, filters, projections, sorts, hash aggregates, window operators, and join algorithms. Used by the join enumerator to pick a winning plan.
  • cardinality – per-relation RelationStats + CardinalityEstimator that turn predicate selectivities into row-count estimates. Equality, range, and LIKE selectivities are all on the same scale (0..=1).
  • join_graphJoinEdge / JoinGraph – the dataflow graph the enumerator walks.
  • join_enumerator – DPccp (Moerkotte/Neumann 2006). Bitmask u64 for relation subsets, HashMap for the DP cache.
  • optimizer – algebraic rewrites: filter pushdown, facet additivity, Boolean simplification.

Re-exports§

pub use cardinality::column_entropy;
pub use cardinality::entropy_cardinality_lower_bound;
pub use cardinality::mutual_information_estimate;
pub use cardinality::AccessParadigm;
pub use cardinality::CardinalityEstimator;
pub use cardinality::ColumnStats;
pub use cardinality::EdgeSample;
pub use cardinality::GraphStats;
pub use cardinality::GraphStoreSampler;
pub use cardinality::LocalAccessEstimate;
pub use cardinality::RelationStats;
pub use cardinality::Selectivity;
pub use cardinality::GRAPH_AVG_DEGREE_DEFAULT;
pub use cardinality::JACCARD_JOIN_SELECTIVITY;
pub use cost_model::CostEstimator;
pub use cost_model::OperatorCost;
pub use cost_model::OperatorKind;
pub use join_enumerator::enumerate_dpccp;
pub use join_enumerator::enumerate_dpccp_with_cost_estimator;
pub use join_enumerator::JoinPlan;
pub use join_graph::JoinEdge;
pub use join_graph::JoinGraph;
pub use join_graph::JoinGraphError;
pub use join_graph::JoinGraphResult;
pub use join_order::JoinAlgorithm;
pub use join_order::JoinCondition;
pub use join_order::JoinOrderOptimizer;
pub use join_order::JoinOrderResult;
pub use join_order::JoinOrderTree;
pub use join_order::JoinPredicate;
pub use join_order::JoinRelation;
pub use optimizer::optimize;
pub use optimizer::optimize_with_aggregates;
pub use optimizer::optimize_with_aggregates_and_statistics;
pub use optimizer::optimize_with_statistics;
pub use optimizer::ConstantEvaluator;
pub use optimizer::OptimizerConfig;
pub use optimizer::SourceStatistics;
pub use query_optimizer::IndexScanCandidate;
pub use query_optimizer::OptimizerConfig as TreeOptimizerConfig;
pub use query_optimizer::QueryOptimizer;
pub use text_top_k::plan_text_top_k;
pub use text_top_k::TextTopKCapabilities;

Modules§

cardinality
Cardinality estimation for SQL predicates and cross-paradigm operator trees.
column_pruning
Required source columns and row metadata for physical query projection.
cost_model
Per-operator cost model.
explain
Explain result rendering and query-block limit placement.
filter_pushdown
Qualifier and CTE output-filter pushdown and specialization.
join_enumerator
DPccp join enumeration following Moerkotte and Neumann (2006).
join_graph
Join graph: nodes are individual relations (a single table or a materialised CTE / subquery output), edges are equijoin predicates. The DPccp enumerator walks this graph to pick a join order.
join_order
Join-order optimization.
mutation_outputs
Prune unused, side-effect-free mutation-source output slots without changing row shape.
optimizer
Plan-native algebraic and cross-paradigm rewrites.
plan_cost
Relational execution and replanning costs in the shared physical cost units.
query_optimizer
Rule-based and cost-aware operator-tree optimizer.
retrieval_planning
Retrieval optimizer setup and checked access estimates over retained catalog inputs.
source_filters
Propagate constant equality predicates across equivalent join keys.
statement_planning
Statement optimization and prepared-plan estimates over explicit catalog and retrieval inputs.
text_top_k
Physical planning for score-ordered text limits.
unified_plan
SQL-owned plan types retained at the planner’s public API boundary.

Structs§

AssignmentPlan
ConflictPlan
CteCyclePlan
Generated cycle mark and path columns for a recursive CTE.
CtePlan
A named query child owned by a QueryPlan.
CteSearchPlan
Generated traversal-order column for a recursive CTE.
DeletePlan
ExpressionPlan
Executable scalar IR plus every query-valued descendant it owns.
InsertPlan
MergePlan
OrderPlan
ProjectionPlan
QueryBlockPlan
One SELECT block after WITH and set-operation structure has been pulled into explicit parent/child nodes.
QueryPlan
A relational query with its CTE scope and one relational root.
ScalarOrder
ScalarWindowFrame
ScalarWindowSpec
TableFunctionPlan
One independently resolved and bound function inside a range-function group.
UpdatePlan
ViewCheckPlan
ViewRuleInsertPlan
ViewRuleReturningPlan
ViewRuleUpdatePlan

Enums§

AccessPathPlan
Cross-paradigm access decision made after the relational and scalar portions of a query block have both been lowered.
CommandPlan
Non-query statement plans. Mutations own physical sources and scalar IR; query-bearing catalog commands own explicit query children. Typed DDL and procedural payloads contain catalog data, never a second SQL dispatcher.
ComputePlan
The SELECT-list phase chosen during lowering.
ConflictActionPlan
CtePlanBody
A relational CTE or a command whose RETURNING relation feeds its consumers.
JoinExecutionStrategy
Physical strategy selected for a relational join.
MergeWhenPlan
RelationalPlan
Relational nodes common to ordinary SQL, retrieval SQL, and table/graph functions.
ScalarExpr
ScalarFrameBound
SourcePlan
The row-producing source below a query block.
UnifiedPlan
One fully lowered SQL statement.

Traits§

AggregateClassifier
Classification hook for engine-registered aggregate functions. Built-in aggregates are always recognised; the callback extends that set without making the planner depend on the engine.

Functions§

rewrite_scalar_expression
Visit one scalar-expression tree in post-order and rewrite each node once.

Type Aliases§

SubqueryId
Index into the query children owned by the enclosing expression plan.