How can I optimize my Cypher Queries?

What should I do if my Cypher query is slower than expected, or uses more memory or CPU than I have?

I'm running my queries with Neo4j Browser, copied from my application.

What should I do? Are there any good practices / pointers?

There are a number of things you can do:

  1. Run your query with PROFILE or EXPLAIN. In the resulting query plan there are indications of expensive operations.
  2. Make sure that lookup operations by id or value (numeric range, text search) run on fields that are indexed.
  3. If you are running updates make sure that your updates handle batches of about 10k-100k records, if you have more, please batch them.

Share your queries and query plans (download and share the PNG) in this #neo4j-graph-platform:cypher category. Then others can help you.
It is also helpful to share your data-model and other statistics, and also the actual Cypher query.

There are already a number of performance related knowledge base posts available.

You can learn more here:

Cheers, Michael

1 Like
I have at least 4,000 "cypher" sentences to write into neo4j, it takes too many time. how can i be quick?
Better way to merge/match loading from csv
Import via http increasingly slow on a large dataset
How to use cypher import csv file and do merge commands using py2neo?
How to perform Machine learning graph CNN on my neo4j graph? I have constructed my graph using neo4j. I would like to see some demo or video links for performing the algorithm on the constructed graph. Can anyone through some valuable insights?
Connecting nodes to build flight path routines
Data has been input by cmd, but I can't visualize it
Formatting new date time instances
How to process heterogeneous data sources (structure, semi structure and unstructured) in Neo4Js using Ontology driven data integration? Any help /reference is highly appreciated
Browser Connection lost and never connects until restart and again dead in few seconds
Crear una aplicacion en php o java para ingresar dos datos a la base de datos neo4j
Importing Movie data from example data set on neoj4
Searching text from each record of MATCH output
How to implement Custom Data Encryption/Decryption Functions/Procedures in apoc for Client Confidential Information
Novice trying to import access database on Mac Os
Import from CSV: Null Error on Non Null Value
Why its taking more time(4190ms) to get response while hitting from aws to server db,and taking only few milliseconds(615ms) from localhost to server db
Not able to restart neo4j Server which is in Cluster