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§
Sourcefn relation_cardinality(&self, rel_id: RelId) -> Option<u64>
fn relation_cardinality(&self, rel_id: RelId) -> Option<u64>
Returns the relation cardinality if it is known and nonzero.
Sourcefn column_ndv(&self, rel_id: RelId, col_idx: usize) -> Option<u64>
fn column_ndv(&self, rel_id: RelId, col_idx: usize) -> Option<u64>
Returns the distinct-value estimate for a relation column.
Sourcefn join_selectivity(
&self,
left_rel: RelId,
right_rel: RelId,
left_col: usize,
right_col: usize,
) -> Option<f64>
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.