pub struct GraphCatalog {
pub label_counts: HashMap<Label, usize>,
pub generation: u64,
/* private fields */
}Expand description
Incrementally maintained graph catalog for cost-based optimization.
Extends (does not replace) the existing GraphStatistics. New planner uses GraphCatalog; old planner path keeps working.
Fields§
§label_counts: HashMap<Label, usize>Node count per label
generation: u64Monotonically increasing version for cache invalidation
Implementations§
Source§impl GraphCatalog
impl GraphCatalog
Sourcepub fn on_label_added(&mut self, label: &Label)
pub fn on_label_added(&mut self, label: &Label)
Notify the catalog that a label was added to a node
Sourcepub fn on_label_removed(&mut self, label: &Label)
pub fn on_label_removed(&mut self, label: &Label)
Notify the catalog that a label was removed from a node (e.g., node deleted)
Sourcepub fn on_edge_created(
&mut self,
source_id: NodeId,
src_labels: &[Label],
edge_type: &EdgeType,
target_id: NodeId,
tgt_labels: &[Label],
)
pub fn on_edge_created( &mut self, source_id: NodeId, src_labels: &[Label], edge_type: &EdgeType, target_id: NodeId, tgt_labels: &[Label], )
Notify the catalog that an edge was created
For a multi-label source and multi-label target, this generates one triple entry per (src_label, edge_type, tgt_label) combination.
Sourcepub fn on_edge_deleted(
&mut self,
source_id: NodeId,
src_labels: &[Label],
edge_type: &EdgeType,
target_id: NodeId,
tgt_labels: &[Label],
)
pub fn on_edge_deleted( &mut self, source_id: NodeId, src_labels: &[Label], edge_type: &EdgeType, target_id: NodeId, tgt_labels: &[Label], )
Notify the catalog that an edge was deleted
Sourcepub fn get_triple_stats(&self, pattern: &TriplePattern) -> Option<&TripleStats>
pub fn get_triple_stats(&self, pattern: &TriplePattern) -> Option<&TripleStats>
Get triple stats for a specific pattern
Sourcepub fn all_triple_stats(&self) -> &HashMap<TriplePattern, TripleStats>
pub fn all_triple_stats(&self) -> &HashMap<TriplePattern, TripleStats>
Get all triple stats
Sourcepub fn estimate_label_scan(&self, label: &Label) -> f64
pub fn estimate_label_scan(&self, label: &Label) -> f64
Estimate the number of rows from a label scan
Sourcepub fn estimate_expand_out(
&self,
source_label: &Label,
edge_type: &EdgeType,
) -> f64
pub fn estimate_expand_out( &self, source_label: &Label, edge_type: &EdgeType, ) -> f64
Estimate cardinality after an outgoing expand from source_label via edge_type
Sourcepub fn estimate_expand_in(
&self,
target_label: &Label,
edge_type: &EdgeType,
) -> f64
pub fn estimate_expand_in( &self, target_label: &Label, edge_type: &EdgeType, ) -> f64
Estimate cardinality after an incoming expand to target_label via edge_type
Sourcepub fn estimate_edge_existence(
&self,
source_label: &Label,
edge_type: &EdgeType,
target_label: &Label,
) -> f64
pub fn estimate_edge_existence( &self, source_label: &Label, edge_type: &EdgeType, target_label: &Label, ) -> f64
Estimate the probability that an edge exists between a specific source and target
Sourcepub fn recompute_full(store: &GraphStore) -> Self
pub fn recompute_full(store: &GraphStore) -> Self
Recompute all catalog statistics from scratch using the graph store. Used for consistency checks — result should match incrementally maintained stats.
Trait Implementations§
Source§impl Clone for GraphCatalog
impl Clone for GraphCatalog
Source§fn clone(&self) -> GraphCatalog
fn clone(&self) -> GraphCatalog
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 GraphCatalog
impl RefUnwindSafe for GraphCatalog
impl Send for GraphCatalog
impl Sync for GraphCatalog
impl Unpin for GraphCatalog
impl UnsafeUnpin for GraphCatalog
impl UnwindSafe for GraphCatalog
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> 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