Skip to main content

TableStatistics

Struct TableStatistics 

Source
#[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

Source

pub const fn new() -> Self

Construct a statistics snapshot with every field zeroed — the same initial state ha_statistics() produces on the C++ side.

Source

pub const fn with_records(self, value: u64) -> Self

Number of live rows in the table.

Source

pub const fn with_data_file_length(self, value: u64) -> Self

Size of the data segment in bytes.

Source

pub const fn with_max_data_file_length(self, value: u64) -> Self

Hard cap MySQL should believe for data_file_length.

Source

pub const fn with_index_file_length(self, value: u64) -> Self

Size of the index segment in bytes.

Source

pub const fn with_max_index_file_length(self, value: u64) -> Self

Hard cap MySQL should believe for index_file_length.

Source

pub const fn with_delete_length(self, value: u64) -> Self

Bytes reclaimable by compacting deleted rows.

Source

pub const fn with_auto_increment_value(self, value: u64) -> Self

Next auto-increment value the engine intends to hand out.

Source

pub const fn with_deleted(self, value: u64) -> Self

Number of tombstoned rows still occupying space.

Source

pub const fn with_mean_rec_length(self, value: u64) -> Self

Physical record length (stats.mean_rec_length on the C++ side).

Source

pub const fn with_create_time(self, value: i64) -> Self

UNIX timestamp the table was created at; mirrors C++ time_t.

Source

pub const fn with_check_time(self, value: u64) -> Self

UNIX timestamp of the last CHECK TABLE run.

Source

pub const fn with_update_time(self, value: u64) -> Self

UNIX timestamp of the last data modification.

Source

pub const fn with_block_size(self, value: u32) -> Self

Index block size in bytes.

Source

pub const fn records(&self) -> u64

Raw record count (read by the shim when copying into ha_statistics).

Source

pub const fn data_file_length(&self) -> u64

Data segment length in bytes.

Source

pub const fn max_data_file_length(&self) -> u64

Hard cap for data_file_length.

Source

pub const fn index_file_length(&self) -> u64

Index segment length in bytes.

Source

pub const fn max_index_file_length(&self) -> u64

Hard cap for index_file_length.

Source

pub const fn delete_length(&self) -> u64

Reclaimable byte count.

Source

pub const fn auto_increment_value(&self) -> u64

Next auto-increment value.

Source

pub const fn deleted(&self) -> u64

Tombstoned row count.

Source

pub const fn mean_rec_length(&self) -> u64

Mean record length.

Source

pub const fn create_time(&self) -> i64

Create-time UNIX timestamp.

Source

pub const fn check_time(&self) -> u64

Last-check UNIX timestamp.

Source

pub const fn update_time(&self) -> u64

Last-update UNIX timestamp.

Source

pub const fn block_size(&self) -> u32

Index block size in bytes.

Trait Implementations§

Source§

impl Clone for TableStatistics

Source§

fn clone(&self) -> TableStatistics

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for TableStatistics

Source§

impl Debug for TableStatistics

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for TableStatistics

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for TableStatistics

Source§

impl PartialEq for TableStatistics

Source§

fn eq(&self, other: &TableStatistics) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for TableStatistics

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more