#[non_exhaustive]pub enum QueryCardinality {
Single,
Multiple,
List,
}Expand description
Query cardinality classification.
Indicates how many entities a query typically returns, which affects expected cache hit rate.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Single
Single entity: WHERE id = ? → 1 entity Expected cache hit rate: 91%
Multiple
Multiple entities: WHERE id IN (?, …) → N entities Expected cache hit rate: 88%
List
All entities: WHERE 1=1 or no WHERE → all entities Expected cache hit rate: 60%
Implementations§
Source§impl QueryCardinality
impl QueryCardinality
Sourcepub const fn expected_hit_rate(&self) -> f64
pub const fn expected_hit_rate(&self) -> f64
Get expected cache hit rate for this cardinality (0-1).
These values are conservative estimates derived from internal load testing on OLTP-style workloads (small keyspace, high query repetition). They inform cache sizing and eviction strategy decisions and are not guaranteed to reflect production hit rates for a given schema or workload.
To calibrate for your workload, compare the cache_hit_rate metric exposed
at /metrics against these values. Operator-specific overrides can be
configured via the cache.expected_hit_rates section in fraiseql.toml:
[fraiseql.cache.expected_hit_rates]
single = 0.85 # default: 0.91
multiple = 0.80 # default: 0.88
list = 0.55 # default: 0.60Trait Implementations§
Source§impl Clone for QueryCardinality
impl Clone for QueryCardinality
Source§fn clone(&self) -> QueryCardinality
fn clone(&self) -> QueryCardinality
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for QueryCardinality
impl Debug for QueryCardinality
Source§impl Ord for QueryCardinality
impl Ord for QueryCardinality
Source§fn cmp(&self, other: &QueryCardinality) -> Ordering
fn cmp(&self, other: &QueryCardinality) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for QueryCardinality
impl PartialEq for QueryCardinality
Source§impl PartialOrd for QueryCardinality
impl PartialOrd for QueryCardinality
impl Copy for QueryCardinality
impl Eq for QueryCardinality
impl StructuralPartialEq for QueryCardinality
Auto Trait Implementations§
impl Freeze for QueryCardinality
impl RefUnwindSafe for QueryCardinality
impl Send for QueryCardinality
impl Sync for QueryCardinality
impl Unpin for QueryCardinality
impl UnsafeUnpin for QueryCardinality
impl UnwindSafe for QueryCardinality
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<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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 more