#[non_exhaustive]pub struct CostConstants { /* private fields */ }Expand description
Engine-specific cost constants the handlerton returns from
get_cost_constants.
Both fields mirror the per-storage-engine values MySQL stores in the
mysql.engine_cost table; the defaults match what
SE_cost_constants(Optimizer::kOriginal) would have produced on the
C++ side, so an engine that supplies only one field starts from a sane
fallback for the other.
Implementations§
Source§impl CostConstants
impl CostConstants
Sourcepub const fn new(memory_block_read_cost: f64, io_block_read_cost: f64) -> Self
pub const fn new(memory_block_read_cost: f64, io_block_read_cost: f64) -> Self
Construct a cost-constants tuple with the given per-block read
costs. Both values must be positive; MySQL’s
SE_cost_constants::set rejects zero or negative values with
INVALID_COST_VALUE, so the shim does the same and an engine
returning either value reverts to the defaults.
Sourcepub const fn defaults() -> Self
pub const fn defaults() -> Self
The defaults SE_cost_constants(Optimizer::kOriginal) initialises
— memory_block_read_cost = 0.25, io_block_read_cost = 1.0.
Engines that want to override one field commonly start from these.
Sourcepub const fn memory_block_read_cost(&self) -> f64
pub const fn memory_block_read_cost(&self) -> f64
Cost of reading one random block from an in-memory buffer.
Sourcepub const fn io_block_read_cost(&self) -> f64
pub const fn io_block_read_cost(&self) -> f64
Cost of reading one random block from disk.
Trait Implementations§
Source§impl Clone for CostConstants
impl Clone for CostConstants
Source§fn clone(&self) -> CostConstants
fn clone(&self) -> CostConstants
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 CostConstants
Source§impl Debug for CostConstants
impl Debug for CostConstants
Source§impl Default for CostConstants
impl Default for CostConstants
Source§impl PartialEq for CostConstants
impl PartialEq for CostConstants
Source§fn eq(&self, other: &CostConstants) -> bool
fn eq(&self, other: &CostConstants) -> bool
self and other values to be equal, and is used by ==.