#[non_exhaustive]pub struct TableStatistics { /* private fields */ }Expand description
Snapshot of the per-table statistics MySQL stores in ha_statistics.
Returned from
Handlerton::get_table_statistics;
the shim copies each field into the matching ha_statistics slot
before handing control back to the optimizer. Engines build instances
through Self::new and the chained with_* setters; missing fields
stay zero, which matches MySQL’s ha_statistics() default constructor.
Implementations§
Source§impl TableStatistics
impl TableStatistics
Sourcepub const fn new() -> Self
pub const fn new() -> Self
Construct a statistics snapshot with every field zeroed — the same
initial state ha_statistics() produces on the C++ side.
Sourcepub const fn with_records(self, value: u64) -> Self
pub const fn with_records(self, value: u64) -> Self
Number of live rows in the table.
Sourcepub const fn with_data_file_length(self, value: u64) -> Self
pub const fn with_data_file_length(self, value: u64) -> Self
Size of the data segment in bytes.
Sourcepub const fn with_max_data_file_length(self, value: u64) -> Self
pub const fn with_max_data_file_length(self, value: u64) -> Self
Hard cap MySQL should believe for data_file_length.
Sourcepub const fn with_index_file_length(self, value: u64) -> Self
pub const fn with_index_file_length(self, value: u64) -> Self
Size of the index segment in bytes.
Sourcepub const fn with_max_index_file_length(self, value: u64) -> Self
pub const fn with_max_index_file_length(self, value: u64) -> Self
Hard cap MySQL should believe for index_file_length.
Sourcepub const fn with_delete_length(self, value: u64) -> Self
pub const fn with_delete_length(self, value: u64) -> Self
Bytes reclaimable by compacting deleted rows.
Sourcepub const fn with_auto_increment_value(self, value: u64) -> Self
pub const fn with_auto_increment_value(self, value: u64) -> Self
Next auto-increment value the engine intends to hand out.
Sourcepub const fn with_deleted(self, value: u64) -> Self
pub const fn with_deleted(self, value: u64) -> Self
Number of tombstoned rows still occupying space.
Sourcepub const fn with_mean_rec_length(self, value: u64) -> Self
pub const fn with_mean_rec_length(self, value: u64) -> Self
Physical record length (stats.mean_rec_length on the C++ side).
Sourcepub const fn with_create_time(self, value: i64) -> Self
pub const fn with_create_time(self, value: i64) -> Self
UNIX timestamp the table was created at; mirrors C++ time_t.
Sourcepub const fn with_check_time(self, value: u64) -> Self
pub const fn with_check_time(self, value: u64) -> Self
UNIX timestamp of the last CHECK TABLE run.
Sourcepub const fn with_update_time(self, value: u64) -> Self
pub const fn with_update_time(self, value: u64) -> Self
UNIX timestamp of the last data modification.
Sourcepub const fn with_block_size(self, value: u32) -> Self
pub const fn with_block_size(self, value: u32) -> Self
Index block size in bytes.
Sourcepub const fn records(&self) -> u64
pub const fn records(&self) -> u64
Raw record count (read by the shim when copying into ha_statistics).
Sourcepub const fn data_file_length(&self) -> u64
pub const fn data_file_length(&self) -> u64
Data segment length in bytes.
Sourcepub const fn max_data_file_length(&self) -> u64
pub const fn max_data_file_length(&self) -> u64
Hard cap for data_file_length.
Sourcepub const fn index_file_length(&self) -> u64
pub const fn index_file_length(&self) -> u64
Index segment length in bytes.
Sourcepub const fn max_index_file_length(&self) -> u64
pub const fn max_index_file_length(&self) -> u64
Hard cap for index_file_length.
Sourcepub const fn delete_length(&self) -> u64
pub const fn delete_length(&self) -> u64
Reclaimable byte count.
Sourcepub const fn auto_increment_value(&self) -> u64
pub const fn auto_increment_value(&self) -> u64
Next auto-increment value.
Sourcepub const fn mean_rec_length(&self) -> u64
pub const fn mean_rec_length(&self) -> u64
Mean record length.
Sourcepub const fn create_time(&self) -> i64
pub const fn create_time(&self) -> i64
Create-time UNIX timestamp.
Sourcepub const fn check_time(&self) -> u64
pub const fn check_time(&self) -> u64
Last-check UNIX timestamp.
Sourcepub const fn update_time(&self) -> u64
pub const fn update_time(&self) -> u64
Last-update UNIX timestamp.
Sourcepub const fn block_size(&self) -> u32
pub const fn block_size(&self) -> u32
Index block size in bytes.
Trait Implementations§
Source§impl Clone for TableStatistics
impl Clone for TableStatistics
Source§fn clone(&self) -> TableStatistics
fn clone(&self) -> TableStatistics
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for TableStatistics
Source§impl Debug for TableStatistics
impl Debug for TableStatistics
Source§impl Default for TableStatistics
impl Default for TableStatistics
impl Eq for TableStatistics
Source§impl PartialEq for TableStatistics
impl PartialEq for TableStatistics
Source§fn eq(&self, other: &TableStatistics) -> bool
fn eq(&self, other: &TableStatistics) -> bool
self and other values to be equal, and is used by ==.