Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

What is the correct way to count number of nodes using Cypher?

For both of these queries, I get the same result.

Query 1:

MATCH (e:Episode)
RETURN COUNT(e);

Query 2:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

MATCH (e:Episode)
WITH COUNT(e) AS count
RETURN count;

What would be the correct way to count the number of nodes?

>Solution :

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.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading