pub struct Statistics { /* private fields */ }Implementations§
Source§impl Statistics
impl Statistics
pub fn new() -> Self
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn get(&self, table: &str, column: &str) -> Option<&ColumnStats>
Sourcepub fn iter(&self) -> impl Iterator<Item = (&(String, String), &ColumnStats)>
pub fn iter(&self) -> impl Iterator<Item = (&(String, String), &ColumnStats)>
Iterate ((table, column), stats) in deterministic
alphabetical order. Used by SELECT * FROM spg_statistic
and by snapshot serialisation.
Sourcepub fn set(&mut self, table: String, column: String, stats: ColumnStats)
pub fn set(&mut self, table: String, column: String, stats: ColumnStats)
Replace (or insert) the stats for one (table, column).
Called by ANALYZE per column.
Sourcepub fn clear_table(&mut self, table: &str)
pub fn clear_table(&mut self, table: &str)
Drop every row whose table key matches table. Called
before re-ANALYZE on a table so columns dropped between
analyses don’t leave stale rows behind.
Sourcepub fn reset_modified(&mut self, table: &str)
pub fn reset_modified(&mut self, table: &str)
Reset the modified-row counter for table. Called at the
end of ANALYZE so v6.2.1 auto-analyze starts a fresh
window.
Sourcepub fn record_modifications(&mut self, table: &str, n: u64)
pub fn record_modifications(&mut self, table: &str, n: u64)
Bump the modified-row counter. The engine’s
exec_insert / exec_update / exec_delete paths feed
this hook so v6.2.1 auto-analyze can read it.
pub fn modified_since_last_analyze(&self, table: &str) -> u64
Sourcepub fn version(&self) -> u64
pub fn version(&self) -> u64
v6.3.1 — current monotonic version. Plan cache snapshots this at prepare time; lookup compares and evicts on mismatch.
Sourcepub fn bump_version(&mut self)
pub fn bump_version(&mut self)
v6.3.1 — bumps the version. Called by exec_analyze after a
successful ANALYZE on any table.
Sourcepub fn serialize(&self) -> Vec<u8>
pub fn serialize(&self) -> Vec<u8>
Format (each block little-endian): [u16 num_columns] for each column: [u16 table_len][table bytes] [u16 col_len][col bytes] [f32 null_frac] [u64 n_distinct] [u16 num_bounds] for each bound: [u16 b_len][b bytes] [u16 num_modified_entries] for each: [u16 t_len][t bytes][u64 modified_count]
pub fn deserialize(buf: &[u8]) -> Result<Self, StatisticsError>
Trait Implementations§
Source§impl Clone for Statistics
impl Clone for Statistics
Source§fn clone(&self) -> Statistics
fn clone(&self) -> Statistics
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Statistics
impl Debug for Statistics
Source§impl Default for Statistics
impl Default for Statistics
Source§fn default() -> Statistics
fn default() -> Statistics
Source§impl PartialEq for Statistics
impl PartialEq for Statistics
Source§fn eq(&self, other: &Statistics) -> bool
fn eq(&self, other: &Statistics) -> bool
self and other values to be equal, and is used by ==.