To count only committed nodes, schema() (crates/grafeo-engine/src/database/admin.rs) checks each node of a label with get_node_at_epoch and has_label, which builds the node with its properties: O(nodes) work and allocation per call. The label index itself is updated before commit, so its O(1) size counts other transactions' uncommitted nodes.
Fix idea: an epoch-aware label count in the graph store (visible versions only, without building nodes), for example a visibility check plus a labels-at-epoch read, or committed per-label counters maintained at commit.
Raised in the review of #541.
To count only committed nodes,
schema()(crates/grafeo-engine/src/database/admin.rs) checks each node of a label withget_node_at_epochandhas_label, which builds the node with its properties: O(nodes) work and allocation per call. The label index itself is updated before commit, so its O(1) size counts other transactions' uncommitted nodes.Fix idea: an epoch-aware label count in the graph store (visible versions only, without building nodes), for example a visibility check plus a labels-at-epoch read, or committed per-label counters maintained at commit.
Raised in the review of #541.