pub struct AdaptiveQueryOptimizer { /* private fields */ }Expand description
Adaptive query optimizer that learns from execution feedback.
Uses a RuntimeFeedbackStore to guide pattern ordering decisions.
Implementations§
Source§impl AdaptiveQueryOptimizer
impl AdaptiveQueryOptimizer
Sourcepub fn with_feedback(feedback: RuntimeFeedbackStore) -> Self
pub fn with_feedback(feedback: RuntimeFeedbackStore) -> Self
Create an optimizer pre-loaded with the given feedback store.
Sourcepub fn set_base_selectivity(
&mut self,
pattern: impl Into<String>,
selectivity: f64,
)
pub fn set_base_selectivity( &mut self, pattern: impl Into<String>, selectivity: f64, )
Set a static base selectivity for a pattern (used as fallback).
Sourcepub fn optimize_join_order(&self, patterns: &[String]) -> Vec<String>
pub fn optimize_join_order(&self, patterns: &[String]) -> Vec<String>
Sort patterns by their estimated selectivity (ascending).
Patterns with lower estimated selectivity are placed first so the query executor processes the most restrictive filters early.
Sourcepub fn feedback(&self) -> &RuntimeFeedbackStore
pub fn feedback(&self) -> &RuntimeFeedbackStore
Immutable access to the underlying feedback store.
Sourcepub fn feedback_mut(&mut self) -> &mut RuntimeFeedbackStore
pub fn feedback_mut(&mut self) -> &mut RuntimeFeedbackStore
Mutable access to the underlying feedback store.
Sourcepub fn record_execution(&mut self, query_hash: u64, stats: QueryStats)
pub fn record_execution(&mut self, query_hash: u64, stats: QueryStats)
Record an execution result, forwarding it to the feedback store.
Sourcepub fn hash_query(query_str: &str) -> u64
pub fn hash_query(query_str: &str) -> u64
Compute a 64-bit hash for an arbitrary query string using the djb2 algorithm, suitable for use as a cache/feedback key.
Sourcepub fn estimate_cardinality(&self, pattern: &str, base_estimate: usize) -> usize
pub fn estimate_cardinality(&self, pattern: &str, base_estimate: usize) -> usize
Estimate the cardinality of a pattern using feedback data.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AdaptiveQueryOptimizer
impl RefUnwindSafe for AdaptiveQueryOptimizer
impl Send for AdaptiveQueryOptimizer
impl Sync for AdaptiveQueryOptimizer
impl Unpin for AdaptiveQueryOptimizer
impl UnsafeUnpin for AdaptiveQueryOptimizer
impl UnwindSafe for AdaptiveQueryOptimizer
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
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>
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>
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