#[non_exhaustive]pub struct CostEstimate { /* private fields */ }Expand description
A cost estimate an engine reports to the optimizer, mirroring MySQL’s
Cost_estimate.
The first three components are time-consuming costs the optimizer sums to compare access paths: I/O, CPU, and import (remote) cost. The fourth, memory cost, tracks bytes the engine expects to allocate and is kept apart from the time-based total. All four use MySQL’s internal cost units.
Returned as Some from table_scan_cost, index_scan_cost, and
read_cost; the shim assembles a Cost_estimate from the components.
This is distinct from the opaque crate::sys::CostEstimate, which is a
borrowed handle to a live MySQL accumulator the binding cannot construct.
§Examples
use mysql_handler::engine::CostEstimate;
let cost = CostEstimate::new(10.0, 2.0, 0.0, 0.0);
assert_eq!(cost.io_cost(), 10.0);
assert_eq!(cost.cpu_cost(), 2.0);Implementations§
Source§impl CostEstimate
impl CostEstimate
Sourcepub const fn new(
io_cost: f64,
cpu_cost: f64,
import_cost: f64,
mem_cost: f64,
) -> Self
pub const fn new( io_cost: f64, cpu_cost: f64, import_cost: f64, mem_cost: f64, ) -> Self
Build a cost estimate from its I/O, CPU, import, and memory components, each in MySQL’s internal cost units.
Sourcepub const fn import_cost(&self) -> f64
pub const fn import_cost(&self) -> f64
Cost of remote (import) operations the access path performs.
Trait Implementations§
Source§impl Clone for CostEstimate
impl Clone for CostEstimate
Source§fn clone(&self) -> CostEstimate
fn clone(&self) -> CostEstimate
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 CostEstimate
Source§impl Debug for CostEstimate
impl Debug for CostEstimate
Source§impl PartialEq for CostEstimate
impl PartialEq for CostEstimate
Source§fn eq(&self, other: &CostEstimate) -> bool
fn eq(&self, other: &CostEstimate) -> bool
self and other values to be equal, and is used by ==.