For the below bug report, we exemplify using the Geography DB from the CypherBench collection of datasets.Schema file.
Expected Behavior
apoc.meta.schema() and apoc.meta.schema({sample: -1}) should return accurate relationship count values per node label, where:
- Outgoing counts are non-zero when relationships exist.
- Source-side (out) and target-side (in) counts for the same directed relationship are equal.
- Per-label-pair counts reflect only relationships between that specific label pair, not global totals.
Actual Behavior
Both commands produce inaccurate count values. Four problems observed:
- Outgoing counts consistently reported as 0 for high-cardinality source labels (in Geography domain e.g., Mountain, River, Lake) even when the target-side incoming count is non-zero. It seems to occur exclusively for outgoing relationships.
- Consequently: source/target counts are contradictory for the same relationship (e.g., flowsThrough: River out → 0, Country in → 82,155).
- Per-label-pair counts equal global totals — the same global count is reported for multiple distinct target labels simultaneously (e.g., both Lake.flowsInto and Ocean.flowsInto report 75,139).
- Sampled mode (without 'sample:-1')severely undercounts (e.g., flowsInto: sampled 1,032 vs full-scan 75,139).
How to Reproduce the Problem
- Load and start a dataset that has directed relationships.
- Run CALL apoc.meta.schema({sample: -1})
- Compare reported counts for 'OUT' relationships against actual counts in the DB. Plus, check the duplication (reuse of global total counts) for relationships that are defined for different node pairs.
- Run CALL apoc.meta.schema() and compare sampled vs full-scan counts
Simple Dataset (where it's possibile)
Geography dataset in https://github.com/megagonlabs/cypherbench. Neo4j docker images are available.
Steps (Mandatory)
- Load and start a dataset that has directed relationships.
- Run CALL apoc.meta.schema({sample: -1})
- Compare reported counts for 'OUT' relationships against actual counts in the DB. Plus, check the duplication (reuse of global total counts) for relationships that are defined for different node pairs.
- Run CALL apoc.meta.schema() and compare sampled vs full-scan counts
Specifications
Version: 2026.04.0
APOC version: 2026.04.0-core
OS: macOS Tahoe 26.3.1
Interface: Neo4j desktop 2
Protocol: neo4j://
For the below bug report, we exemplify using the Geography DB from the CypherBench collection of datasets.Schema file.
Expected Behavior
apoc.meta.schema() and apoc.meta.schema({sample: -1}) should return accurate relationship count values per node label, where:
Actual Behavior
Both commands produce inaccurate count values. Four problems observed:
How to Reproduce the Problem
Simple Dataset (where it's possibile)
Geography dataset in https://github.com/megagonlabs/cypherbench. Neo4j docker images are available.
Steps (Mandatory)
Specifications
Version: 2026.04.0
APOC version: 2026.04.0-core
OS: macOS Tahoe 26.3.1
Interface: Neo4j desktop 2
Protocol: neo4j://