pub struct AdaptiveQueryPlan {
pub patterns: Vec<TriplePattern>,
pub estimated_costs: Vec<PatternCost>,
pub reorder_threshold: u64,
/* private fields */
}Expand description
A query plan that can reorder its triple patterns at runtime based on observed intermediate result sizes.
The plan starts with an optimized static ordering produced by
JoinOrderOptimizer, then checks after each pattern execution whether
the actual cardinality diverges enough from the estimate to warrant
re-ordering the remaining patterns.
Fields§
§patterns: Vec<TriplePattern>Current ordered list of triple patterns.
estimated_costs: Vec<PatternCost>Pre-computed cost estimates (same order as patterns).
reorder_threshold: u64How much actual cardinality must differ from estimate (as a ratio) before we trigger a re-order. Default: 5.0 (5×).
Implementations§
Source§impl AdaptiveQueryPlan
impl AdaptiveQueryPlan
Sourcepub fn new(patterns: Vec<TriplePattern>, stats: &JoinGraphStats) -> Self
pub fn new(patterns: Vec<TriplePattern>, stats: &JoinGraphStats) -> Self
Create a plan from a slice of patterns, immediately optimizing their order.
Sourcepub fn with_reorder_threshold(self, threshold: u64) -> Self
pub fn with_reorder_threshold(self, threshold: u64) -> Self
Set the reorder threshold ratio (actual / expected must exceed this).
Sourcepub fn should_reorder(
&self,
actual_cardinality: u64,
pattern_idx: usize,
) -> bool
pub fn should_reorder( &self, actual_cardinality: u64, pattern_idx: usize, ) -> bool
Check whether the observed actual cardinality for pattern_idx is far
enough from the estimate to justify reordering remaining patterns.
Sourcepub fn reorder_from(&mut self, pattern_idx: usize, stats: &JoinGraphStats)
pub fn reorder_from(&mut self, pattern_idx: usize, stats: &JoinGraphStats)
Reorder the remaining patterns (starting at pattern_idx) given updated
stats derived from observed intermediate results.
Sourcepub fn next_pattern(&mut self) -> Option<&TriplePattern>
pub fn next_pattern(&mut self) -> Option<&TriplePattern>
Advance the plan to the next pattern. Returns the next pattern or None
if the plan is exhausted.
Trait Implementations§
Source§impl Clone for AdaptiveQueryPlan
impl Clone for AdaptiveQueryPlan
Source§fn clone(&self) -> AdaptiveQueryPlan
fn clone(&self) -> AdaptiveQueryPlan
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for AdaptiveQueryPlan
impl RefUnwindSafe for AdaptiveQueryPlan
impl Send for AdaptiveQueryPlan
impl Sync for AdaptiveQueryPlan
impl Unpin for AdaptiveQueryPlan
impl UnsafeUnpin for AdaptiveQueryPlan
impl UnwindSafe for AdaptiveQueryPlan
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<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.