Book Image

Graph Data Processing with Cypher

By : Ravindranatha Anthapu
Book Image

Graph Data Processing with Cypher

By: Ravindranatha Anthapu

Overview of this book

While it is easy to learn and understand the Cypher declarative language for querying graph databases, it can be very difficult to master it. As graph databases are becoming more mainstream, there is a dearth of content and guidance for developers to leverage database capabilities fully. This book fills the information gap by describing graph traversal patterns in a simple and readable way. This book provides a guided tour of Cypher from understanding the syntax, building a graph data model, and loading the data into graphs to building queries and profiling the queries for best performance. It introduces APOC utilities that can augment Cypher queries to build complex queries. You’ll also be introduced to visualization tools such as Bloom to get the most out of the graph when presenting the results to the end users. After having worked through this book, you’ll have become a seasoned Cypher query developer with a good understanding of the query language and how to use it for the best performance.
Table of Contents (18 chapters)
1
Part 1: Cypher Introduction
4
Part 2: Working with Cypher
9
Part 3: Advanced Cypher Concepts

Working with PROFILE

The PROFILE clause executes as per the plan created by the database and provides the exact cost of the query. It will keep track of how many rows pass through the operators and the amount of work the database is doing that is measured as database hits.

Let’s look at a basic example and compare the EXPLAIN and PROFILE plans:

PROFILE MATCH (d {code:'313820'})
RETURN d

In the query, we can see that the only difference is we are using PROFILE instead of EXPLAIN:

Figure 9.6 – Basic query without EXPLAIN and PROFILE label comparison

We can see that the plan remained exactly the same, but we are seeing the db hits, which are the measurement of how much work the database is doing. You can think of 1 db hit as a unit of work the database is doing. More db hits mean a plan step is taking more work than the database is doing to complete that step in the query. Also, more db hits mean that it’s taking more time...