pub struct Cost {
pub cpu: f64,
pub io: f64,
pub memory: f64,
}Expand description
The estimated cost of an operation, split across three resources.
The fields are additive resource quantities, not a single score.
Cost::total collapses them into one comparable number, and the
PartialOrd/Ord impls order by that total so a collection of
candidate costs can be sorted directly.
§Examples
use vlorql_core::statistics::Cost;
let scan = Cost { cpu: 100.0, io: 10.0, memory: 0.0 };
let sort = Cost { cpu: 20.0, io: 0.0, memory: 50.0 };
let combined = scan + sort;
assert_eq!(combined.cpu, 120.0);
assert!(scan.total() > sort.total());Fields§
§cpu: f64Estimated CPU work (in abstract per-row units).
io: f64Estimated IO work (rows read from or written to storage).
memory: f64Estimated peak memory (rows held in memory at once).
Implementations§
Trait Implementations§
impl Copy for Cost
Source§impl PartialOrd for Cost
impl PartialOrd for Cost
impl StructuralPartialEq for Cost
Auto Trait Implementations§
impl Freeze for Cost
impl RefUnwindSafe for Cost
impl Send for Cost
impl Sync for Cost
impl Unpin for Cost
impl UnsafeUnpin for Cost
impl UnwindSafe for Cost
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request