pub struct GraphStats {Show 16 fields
pub node_count: usize,
pub relationship_count: usize,
pub nodes_by_label: BTreeMap<String, usize>,
pub relationships_by_type: BTreeMap<String, usize>,
pub node_distinct_values: Arc<DistinctValues>,
pub relationship_distinct_values: Arc<DistinctValues>,
pub node_range_indexes: BTreeSet<(String, String)>,
pub relationship_range_indexes: BTreeSet<(String, String)>,
pub node_text_indexes: BTreeSet<(String, String)>,
pub relationship_text_indexes: BTreeSet<(String, String)>,
pub node_point_indexes: BTreeSet<(String, String)>,
pub relationship_point_indexes: BTreeSet<(String, String)>,
pub node_vector_indexes: BTreeSet<(String, String)>,
pub relationship_vector_indexes: BTreeSet<(String, String)>,
pub node_list_elements: BTreeMap<(String, String), ListElementStats>,
pub relationship_list_elements: BTreeMap<(String, String), ListElementStats>,
}Expand description
Snapshot of graph cardinality. Populated by the storage backend
(see [super::InMemoryGraph::stats]).
Fields§
§node_count: usizeTotal live node count.
relationship_count: usizeTotal live relationship count.
nodes_by_label: BTreeMap<String, usize>Per-label node count. nodes_by_label[label].len().
relationships_by_type: BTreeMap<String, usize>Per-rel-type relationship count. relationships_by_type[type].len().
node_distinct_values: Arc<DistinctValues>Per-(label, property) approximate distinct value count, for
every property key that a live node with that label carries,
indexed or not. Estimated from a distinct-value sketch kept on
every write (see memory::distinct_stats): a function of the live
data alone, so a restarted process, the writer and a process with
a different lookup history get the same numbers. Absent only for
keys no node of the label has (or whose values the hash index
can’t key: NaN, durations, points, vectors). Shared: the store
reuses one map while the estimates don’t change.
relationship_distinct_values: Arc<DistinctValues>Per-(relationship type, property) distinct value count; as above.
node_range_indexes: BTreeSet<(String, String)>Online catalog-backed range indexes by (label_or_type, property).
relationship_range_indexes: BTreeSet<(String, String)>§node_text_indexes: BTreeSet<(String, String)>Online catalog-backed text indexes by (label_or_type, property).
relationship_text_indexes: BTreeSet<(String, String)>§node_point_indexes: BTreeSet<(String, String)>Online catalog-backed point indexes by (label_or_type, property).
relationship_point_indexes: BTreeSet<(String, String)>§node_vector_indexes: BTreeSet<(String, String)>Online catalog-backed vector indexes by (label_or_type, property).
Tracked alongside the other index scopes so the optimizer / planner
can see them in stats fingerprints, though kNN currently goes
through a flat per-query scan rather than a dedicated structure.
relationship_vector_indexes: BTreeSet<(String, String)>§node_list_elements: BTreeMap<(String, String), ListElementStats>List elements held by the RANGE index scopes whose property holds
lists, by (label_or_type, property): what an element seek
($x IN n.list) is costed from. Exact counts, kept on every write.
relationship_list_elements: BTreeMap<(String, String), ListElementStats>Implementations§
Source§impl GraphStats
impl GraphStats
Sourcepub fn estimate_node_property_equality(
&self,
label: &str,
property: &str,
) -> Option<u64>
pub fn estimate_node_property_equality( &self, label: &str, property: &str, ) -> Option<u64>
Selectivity of an equality predicate label:prop = value.
Returns Some(rows) when we have enough info to answer; None
when the optimizer should fall back to its conservative default.
Sourcepub fn estimate_node_list_element(
&self,
label: &str,
property: &str,
) -> Option<u64>
pub fn estimate_node_list_element( &self, label: &str, property: &str, ) -> Option<u64>
Rows an element seek $x IN label.property finds, from the RANGE
index on the pair: the average entities per element, or 0 when
the indexed values hold no list element. None without the index.
Sourcepub fn estimate_relationship_list_element(
&self,
rel_type: &str,
property: &str,
) -> Option<u64>
pub fn estimate_relationship_list_element( &self, rel_type: &str, property: &str, ) -> Option<u64>
Mirror of Self::estimate_node_list_element for relationships.
pub fn label_count(&self, label: &str) -> Option<u64>
pub fn relationship_type_count(&self, rel_type: &str) -> Option<u64>
pub fn fingerprint(&self) -> u64
Sourcepub fn plan_signature(&self) -> u64
pub fn plan_signature(&self) -> u64
Hash of what the planner reads from these stats, with every
cardinality coarsened to a power-of-two bucket (see
PlanSignature). Two stats with the same signature have the
same labels, types, counted keys and online index scopes, and
counts within a factor of two: a plan made for one is a sound
and reasonable plan for the other. Plans never depend on stats
for correctness, only for cost.
pub fn has_node_range_index(&self, label: &str, property: &str) -> bool
pub fn has_node_text_index(&self, label: &str, property: &str) -> bool
pub fn has_node_point_index(&self, label: &str, property: &str) -> bool
pub fn has_relationship_range_index( &self, rel_type: &str, property: &str, ) -> bool
pub fn has_relationship_text_index( &self, rel_type: &str, property: &str, ) -> bool
pub fn has_relationship_point_index( &self, rel_type: &str, property: &str, ) -> bool
pub fn has_node_vector_index(&self, label: &str, property: &str) -> bool
pub fn has_relationship_vector_index( &self, rel_type: &str, property: &str, ) -> bool
Trait Implementations§
Source§impl Clone for GraphStats
impl Clone for GraphStats
Source§impl Debug for GraphStats
impl Debug for GraphStats
Source§impl Default for GraphStats
impl Default for GraphStats
impl Eq for GraphStats
Source§impl PartialEq for GraphStats
impl PartialEq for GraphStats
impl StructuralPartialEq for GraphStats
Auto Trait Implementations§
impl Freeze for GraphStats
impl RefUnwindSafe for GraphStats
impl Send for GraphStats
impl Sync for GraphStats
impl Unpin for GraphStats
impl UnsafeUnpin for GraphStats
impl UnwindSafe for GraphStats
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> 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