pub struct Optimizer { /* private fields */ }Expand description
Query optimizer that applies optimization passes.
Implementations§
Source§impl Optimizer
impl Optimizer
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new optimizer with default passes.
The default passes are applied in this order:
- NotSimplification - Simplify NOT expressions (double negation, De Morgan)
- AndPredicatePass - Break down AND predicates into chained filters
- CrossProductPass - Convert multi-way cross products to binary tree
- ImplicitJoinsPass - Convert CrossProduct + Filter to Join
- OuterJoinSimplification - Convert outer joins to inner when WHERE rejects NULL
- PredicatePushdown - Push filters down the plan tree
- JoinReorder - Reorder joins for better performance
Note: IndexSelection is not included by default because it requires
ExecutionContext with index information. Use with_passes() to add it.
Sourcepub fn with_passes(passes: Vec<Box<dyn OptimizerPass>>) -> Self
pub fn with_passes(passes: Vec<Box<dyn OptimizerPass>>) -> Self
Creates an optimizer with custom passes.
Sourcepub fn optimize(&self, plan: LogicalPlan) -> LogicalPlan
pub fn optimize(&self, plan: LogicalPlan) -> LogicalPlan
Optimizes a logical plan.
Sourcepub fn to_physical(&self, plan: LogicalPlan) -> PhysicalPlan
pub fn to_physical(&self, plan: LogicalPlan) -> PhysicalPlan
Converts a logical plan to a physical plan. Also applies physical plan optimizations (TopNPushdown).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Optimizer
impl !RefUnwindSafe for Optimizer
impl !Send for Optimizer
impl !Sync for Optimizer
impl Unpin for Optimizer
impl !UnwindSafe for Optimizer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more