pub struct GraphStats {Show 14 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)>,
}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)>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.