pub struct Optimizer { /* private fields */ }Expand description
Transforms logical plans for faster execution.
Create with new(), then call optimize().
Use the builder methods to enable/disable specific optimizations.
Implementations§
Source§impl Optimizer
impl Optimizer
Sourcepub fn from_store(store: &LpgStore) -> Self
pub fn from_store(store: &LpgStore) -> Self
Creates an optimizer with cardinality estimates from the store’s statistics.
Pre-populates the cardinality estimator with per-label row counts and edge type fanout. Ensures statistics are fresh before reading.
Sourcepub fn with_filter_pushdown(self, enabled: bool) -> Self
pub fn with_filter_pushdown(self, enabled: bool) -> Self
Enables or disables filter pushdown.
Sourcepub fn with_join_reorder(self, enabled: bool) -> Self
pub fn with_join_reorder(self, enabled: bool) -> Self
Enables or disables join reordering.
Sourcepub fn with_projection_pushdown(self, enabled: bool) -> Self
pub fn with_projection_pushdown(self, enabled: bool) -> Self
Enables or disables projection pushdown.
Sourcepub fn with_cost_model(self, cost_model: CostModel) -> Self
pub fn with_cost_model(self, cost_model: CostModel) -> Self
Sets the cost model.
Sourcepub fn with_cardinality_estimator(self, estimator: CardinalityEstimator) -> Self
pub fn with_cardinality_estimator(self, estimator: CardinalityEstimator) -> Self
Sets the cardinality estimator.
Sourcepub fn with_selectivity_config(self, config: SelectivityConfig) -> Self
pub fn with_selectivity_config(self, config: SelectivityConfig) -> Self
Sets the selectivity configuration for the cardinality estimator.
Sourcepub fn cost_model(&self) -> &CostModel
pub fn cost_model(&self) -> &CostModel
Returns a reference to the cost model.
Sourcepub fn cardinality_estimator(&self) -> &CardinalityEstimator
pub fn cardinality_estimator(&self) -> &CardinalityEstimator
Returns a reference to the cardinality estimator.
Sourcepub fn estimate_cost(&self, plan: &LogicalPlan) -> Cost
pub fn estimate_cost(&self, plan: &LogicalPlan) -> Cost
Estimates the cost of a plan.
Sourcepub fn estimate_cardinality(&self, plan: &LogicalPlan) -> f64
pub fn estimate_cardinality(&self, plan: &LogicalPlan) -> f64
Estimates the cardinality of a plan.
Sourcepub fn optimize(&self, plan: LogicalPlan) -> Result<LogicalPlan>
pub fn optimize(&self, plan: LogicalPlan) -> Result<LogicalPlan>
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more