Reputation: 1411
For both of these queries, I get the same result.
Query 1:
MATCH (e:Episode)
RETURN COUNT(e);
Query 2:
MATCH (e:Episode)
WITH COUNT(e) AS count
RETURN count;
What would be the correct way to count the number of nodes?
Upvotes: 0
Views: 193
Reputation: 265668
There's no functional difference for such a simple query. Go with the first option, it is shorter and expresses very clearly what you want.
If you run both your queries with EXPLAIN
or PROFILE
, you will see that the executions plans are identical.
Upvotes: 1