cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Count mismatch

The counts are shown different by a good margin at a particular time
How is that possible?
The label count() shows less number compared to exists count()

neo4j> MATCH (n:User) where exists(n.user_id) RETURN count(*);
+----------+
| count(*) |
+----------+
| 8340287  |
+----------+

1 row available after 1130 ms, consumed after another 0 ms
neo4j> MATCH (n:User) RETURN count(*);
+----------+
| count(*) |
+----------+
| 8322843  |
+----------+

1 row available after 5 ms, consumed after another 0 ms
1 ACCEPTED SOLUTION

please stop Neo4j
remove graph.db/neostore.count.db*
restart Neo4j

this should rebuild the internal counts. let me know if this addresses the issue

View solution in original post

3 REPLIES 3

not sure if i see the issue here

the first MATCH statement says count the number of nodes with a label of :User and the node also has a property created name user_id.

the 2nd MATCH simply counts the number of nodes with a label of :User.

Presumably there are a number of :User nodes with no property named user_id and these should be visitble via

match (n:User) where NOT exists(n.user_id) return n;

if you will see, then the counts of number of nodes for label user is less then compared to label user where exists user_id

please stop Neo4j
remove graph.db/neostore.count.db*
restart Neo4j

this should rebuild the internal counts. let me know if this addresses the issue

Nodes 2022
Nodes
NODES 2022, Neo4j Online Education Summit

All the sessions of the conference are now available online