pub struct CardinalityFeedback {
pub predicate_hash: u64,
pub table_name: String,
pub column_name: Option<String>,
pub estimated_rows: u64,
pub actual_rows: u64,
pub correction_factor: f64,
pub sample_count: u64,
pub last_updated: i64,
}Expand description
Cardinality feedback entry for a predicate pattern
Fields§
§predicate_hash: u64Hash of the predicate structure (not values)
table_name: StringTable name this feedback applies to
column_name: Option<String>Column name (if applicable)
estimated_rows: u64Estimated row count from cost model
actual_rows: u64Actual row count from execution
correction_factor: f64Correction factor (actual/estimated), smoothed over samples
sample_count: u64Number of samples used to compute the correction
last_updated: i64Last update timestamp (nanoseconds since epoch)
Implementations§
Source§impl CardinalityFeedback
impl CardinalityFeedback
Sourcepub fn new(
predicate_hash: u64,
table_name: impl Into<String>,
column_name: Option<String>,
estimated_rows: u64,
actual_rows: u64,
) -> Self
pub fn new( predicate_hash: u64, table_name: impl Into<String>, column_name: Option<String>, estimated_rows: u64, actual_rows: u64, ) -> Self
Create a new feedback entry from estimated and actual row counts
Sourcepub fn update(
&mut self,
estimated_rows: u64,
actual_rows: u64,
decay_factor: f64,
)
pub fn update( &mut self, estimated_rows: u64, actual_rows: u64, decay_factor: f64, )
Update feedback with a new sample using exponential moving average
Sourcepub fn is_reliable(&self) -> bool
pub fn is_reliable(&self) -> bool
Check if this feedback has enough samples to be reliable
Sourcepub fn apply_correction(&self, base_estimate: u64) -> u64
pub fn apply_correction(&self, base_estimate: u64) -> u64
Apply correction to an estimate
Trait Implementations§
Source§impl Clone for CardinalityFeedback
impl Clone for CardinalityFeedback
Source§fn clone(&self) -> CardinalityFeedback
fn clone(&self) -> CardinalityFeedback
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for CardinalityFeedback
impl RefUnwindSafe for CardinalityFeedback
impl Send for CardinalityFeedback
impl Sync for CardinalityFeedback
impl Unpin for CardinalityFeedback
impl UnsafeUnpin for CardinalityFeedback
impl UnwindSafe for CardinalityFeedback
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