Neo4j: WHERE Clause vs Curly Braces in MATCH Clause


With Cypher Query Language, you can write similar queries that yield the same result.

For example:-

MATCH (p:Person)-[:loves]->(b:Beverage) 
WHERE = 'Dark Roast' 

… AND …

MATCH (p:Person)-[:loves]->(b:Beverage{name:'Dark Roast'}) 

… returns the same result.

So, which one is better in terms of performance?


Neo4j provides a very helpful command called EXPLAIN that allows us to do some investigation ourselves.

The EXPLAIN command displays the query plan without actually executing the query.

To use it, just add EXPLAIN in front of the query.

In this example, both queries produce exactly the same query plan.

In another word, while both queries look slightly different, they perform exactly the same.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s