Skip to main content

StatsSource

Trait StatsSource 

Source
pub trait StatsSource {
    // Required methods
    fn relation_cardinality(&self, rel_id: RelId) -> Option<u64>;
    fn column_ndv(&self, rel_id: RelId, col_idx: usize) -> Option<u64>;
    fn join_selectivity(
        &self,
        left_rel: RelId,
        right_rel: RelId,
        left_col: usize,
        right_col: usize,
    ) -> Option<f64>;
    fn prefix_degree(&self, rel_id: RelId, col_idx: usize) -> Option<(f64, f64)>;
    fn key_heat(&self, rel_id: RelId, col_idx: usize) -> Option<(f64, f64)>;
}
Expand description

Relation-level statistics required by the full-variable WCOJ planner.

The trait intentionally reads the existing xlog-stats snapshot surface instead of introducing a planner-private stats accumulator. Implementations should return None for missing or unseeded observations so planning can decline incomplete stats without panicking.

Required Methods§

Source

fn relation_cardinality(&self, rel_id: RelId) -> Option<u64>

Returns the relation cardinality if it is known and nonzero.

Source

fn column_ndv(&self, rel_id: RelId, col_idx: usize) -> Option<u64>

Returns the distinct-value estimate for a relation column.

Source

fn join_selectivity( &self, left_rel: RelId, right_rel: RelId, left_col: usize, right_col: usize, ) -> Option<f64>

Returns the observed selectivity between two relation columns.

Source

fn prefix_degree(&self, rel_id: RelId, col_idx: usize) -> Option<(f64, f64)>

Returns average and maximum prefix degree for a relation column.

Source

fn key_heat(&self, rel_id: RelId, col_idx: usize) -> Option<(f64, f64)>

Returns heat and skew factor for a relation column.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl StatsSource for StatsSnapshot

Source§

fn relation_cardinality(&self, rel_id: RelId) -> Option<u64>

Source§

fn column_ndv(&self, rel_id: RelId, col_idx: usize) -> Option<u64>

Source§

fn join_selectivity( &self, left_rel: RelId, right_rel: RelId, left_col: usize, right_col: usize, ) -> Option<f64>

Source§

fn prefix_degree(&self, rel_id: RelId, col_idx: usize) -> Option<(f64, f64)>

Source§

fn key_heat(&self, rel_id: RelId, col_idx: usize) -> Option<(f64, f64)>

Implementors§