Database Reference
In-Depth Information
Execution engine : Re-use the object of ExecutionEngine . Though it
is a small thing, if it is not taken care of, it can cause a considerable de-
gradation of Cypher queries.
Patterns in the WHERE clause : It is not that you cannot use it but it comes with
a cost, which if taken care of, can considerably improve the time of the execution.
Patterns in WHERE should be used only for the not conditions otherwise all other
patterns can be used either in Match or we can combine two Match statements
using the WITH clause. Always remember to use the WHERE condition only to fil-
ter the result set and-for all other cases such as selecting the results-use MATCH .
Indexing/Constraints : Cypher uses indexes and constraints to scan the nodes and
relationships. Depending upon your dataset and query, you should carefully ana-
lyze and see whether all the required indexes and constraints are AVAILABLE
and ONLINE.
Data filtering : Data should be filtered as early as possible with the least possible
matches involved. It helps in scanning smaller result sets as we move forward and
evaluate the rest of the query.
Data model : In Neo4j, everything is based on the data model. A good under-
standing of the data model provides a good sense of structure of the graph, organ-
ization of nodes, relationships, highly / sparsely connected nodes, and so on. It is
important to understand the data model for writing efficient queries to retrieve the
data.
Optimization and tuning are very subjective and may vary from case to case, but all the
guidelines mentioned earlier will help you to uncover and solve performance pitfalls for
most of the scenarios. However, there is still room for the rarest of rare cases, and for all
those, drop your queries at http://stackoverflow.com/questions/tagged/neo4j or ht-
tps://support.neo4j.com/ .
Search WWH ::




Custom Search