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.