pub struct EstimationLog { /* private fields */ }Expand description
Collects estimate vs actual cardinality data for query plan analysis.
After executing a query, call record() for each
operator with its estimated and actual cardinalities. Then use
should_replan() to decide whether the plan
should be re-optimized.
Implementations§
Source§impl EstimationLog
impl EstimationLog
Sourcepub fn new(replan_threshold: f64) -> Self
pub fn new(replan_threshold: f64) -> Self
Creates a new estimation log with the given re-planning threshold.
Sourcepub fn record(
&mut self,
operator: impl Into<String>,
estimated: f64,
actual: f64,
)
pub fn record( &mut self, operator: impl Into<String>, estimated: f64, actual: f64, )
Records an estimate-vs-actual observation.
Sourcepub fn entries(&self) -> &[EstimationEntry]
pub fn entries(&self) -> &[EstimationEntry]
Returns all recorded entries.
Sourcepub fn should_replan(&self) -> bool
pub fn should_replan(&self) -> bool
Returns whether any operator’s estimation error exceeds the threshold, indicating the plan should be re-optimized.
Sourcepub fn max_error_ratio(&self) -> f64
pub fn max_error_ratio(&self) -> f64
Returns the maximum error ratio across all entries.
Trait Implementations§
Source§impl Clone for EstimationLog
impl Clone for EstimationLog
Source§fn clone(&self) -> EstimationLog
fn clone(&self) -> EstimationLog
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for EstimationLog
impl Debug for EstimationLog
Source§impl Default for EstimationLog
impl Default for EstimationLog
Source§fn default() -> EstimationLog
fn default() -> EstimationLog
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for EstimationLog
impl RefUnwindSafe for EstimationLog
impl Send for EstimationLog
impl Sync for EstimationLog
impl Unpin for EstimationLog
impl UnsafeUnpin for EstimationLog
impl UnwindSafe for EstimationLog
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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