pub struct QueryStats {
pub version: u32,
pub families: BTreeMap<IndexFamily, FamilyStats>,
pub total_observations: u64,
}Expand description
Aggregated statistics across all index families.
version is bumped when the on-disk layout changes; loaders refuse to
read incompatible versions.
Fields§
§version: u32Storage format version.
families: BTreeMap<IndexFamily, FamilyStats>Per-family running aggregates.
total_observations: u64Total number of observations recorded since creation.
Implementations§
Source§impl QueryStats
impl QueryStats
Sourcepub const CURRENT_VERSION: u32 = 1
pub const CURRENT_VERSION: u32 = 1
On-disk format version this build emits.
Sourcepub fn family_stats(&self, family: IndexFamily) -> &FamilyStats
pub fn family_stats(&self, family: IndexFamily) -> &FamilyStats
Borrow stats for a specific family (always present after default()).
Sourcepub fn record(&mut self, obs: QueryObservation)
pub fn record(&mut self, obs: QueryObservation)
Record a new observation, updating running aggregates.
Sourcepub fn recommended_weights(&self, prior: &CostWeights) -> CostWeights
pub fn recommended_weights(&self, prior: &CostWeights) -> CostWeights
Recommend cost-model weights from accumulated observations.
The weight for a family is set to mean_observed_latency_us / mean_predicted_cost, capped to the safe range enforced by
CostWeights::set. Families with no observations keep their
previous weights.
Pass the current weights as prior so untouched families retain
their existing values.
Trait Implementations§
Source§impl Clone for QueryStats
impl Clone for QueryStats
Source§fn clone(&self) -> QueryStats
fn clone(&self) -> QueryStats
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for QueryStats
impl Debug for QueryStats
Source§impl Default for QueryStats
impl Default for QueryStats
Source§impl<'de> Deserialize<'de> for QueryStats
impl<'de> Deserialize<'de> for QueryStats
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for QueryStats
impl PartialEq for QueryStats
Source§impl Serialize for QueryStats
impl Serialize for QueryStats
impl StructuralPartialEq for QueryStats
Auto Trait Implementations§
impl Freeze for QueryStats
impl RefUnwindSafe for QueryStats
impl Send for QueryStats
impl Sync for QueryStats
impl Unpin for QueryStats
impl UnsafeUnpin for QueryStats
impl UnwindSafe for QueryStats
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.