pub struct StatisticsMaintenance { /* private fields */ }Expand description
Transactional maintenance metadata. Existing column statistics remain available while this record tracks changes awaiting a replacement.
Implementations§
Source§impl StatisticsMaintenance
impl StatisticsMaintenance
pub const KEY_PREFIX: &'static str = "uqa.statistics.maintenance.v1:"
pub fn key(table: &str) -> String
pub fn load( catalog: &dyn CatalogFacade, table: &str, ) -> StorageBackendResult<Self>
pub fn load_for( catalog: &dyn CatalogFacade, table: &str, object_id: [u8; 16], ) -> StorageBackendResult<Self>
pub fn save( &self, catalog: &dyn CatalogFacade, table: &str, ) -> StorageBackendResult<()>
pub fn dirty(&self) -> bool
pub fn missing(&self, statistics_empty: bool) -> bool
pub fn invalidates_existing_statistics(&self) -> bool
pub fn due(&self, missing: bool, now: u64, statistics_format: u32) -> bool
Sourcepub fn defers(&self, unrecorded: u64, now: u64) -> bool
pub fn defers(&self, unrecorded: u64, now: u64) -> bool
Whether a session may keep unrecorded changes of its commits to itself instead of recording them now. A record written by every commit is a write of two records to each of them, and the count decides only when an analysis becomes due, so a session records the changes that decide something: the first one after an analysis, which marks the statistics stale and starts their age, and the ones that make an analysis due. Otherwise it keeps up to a quarter of what makes one due, or sixteen changes of a small table, which bounds what sessions hide from one another and what a session loses when it ends. While an analysis is due already, more changes decide nothing.
pub fn analyzed_for( catalog: &dyn CatalogFacade, table: &str, object_id: [u8; 16], rows: u64, statistics_format: u32, sampled_at: Option<u64>, ) -> StorageBackendResult<()>
Sourcepub fn analyzed(
&mut self,
object_id: [u8; 16],
rows: u64,
statistics_format: u32,
sampled_at: Option<u64>,
) -> StorageBackendResult<()>
pub fn analyzed( &mut self, object_id: [u8; 16], rows: u64, statistics_format: u32, sampled_at: Option<u64>, ) -> StorageBackendResult<()>
Record a completed analysis of rows rows, which covers every change counted before it. sampled_at is the commit sequence its sample read at, or None when that is not known.
Sourcepub fn covers(&self, through: Option<u64>) -> bool
pub fn covers(&self, through: Option<u64>) -> bool
Whether the last analysis sampled every commit up to through, so that changes a session kept of commits up to there need no counting.
Sourcepub fn same_analysis(&self, other: &Self) -> bool
pub fn same_analysis(&self, other: &Self) -> bool
Row changes retain the last statistics publication; another analysis replaces it even when the resulting estimates happen to be identical.
Sourcepub fn merge_sample(
&self,
before: &Self,
current: &Self,
data_changed: bool,
now: u64,
) -> StorageBackendResult<Option<Self>>
pub fn merge_sample( &self, before: &Self, current: &Self, data_changed: bool, now: u64, ) -> StorageBackendResult<Option<Self>>
Publish this sample’s reset over changes recorded since before. The caller
must first verify that the relation and its last statistics publication
still have the captured identities. A changed data generation can also
represent writes retained privately by their sessions: keep one pending
change in that case so their absence from the counter cannot mark the
sampled statistics current. The counter is a maintenance estimate.
pub fn record_changes( &mut self, object_id: [u8; 16], count: u64, previous_rows: Option<u64>, now: u64, ) -> StorageBackendResult<()>
Sourcepub fn encode(
&self,
control: &StorageReadControl,
) -> VersionResult<BudgetedVec<u8>>
pub fn encode( &self, control: &StorageReadControl, ) -> VersionResult<BudgetedVec<u8>>
Encode the fixed-size state under the same budget and cancellation control as its record.