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 EXPLAIN

The EXPLAIN clause returns a query execution plan as the database sees it. It does not actually execute the query and does not return data. It does not make any changes to the database itself. It can be used to easily identify missing indexes or query plans not using existing indexes, and so on. Also, it tells us how a query is traversing relationships to do its work.

Let’s look at a basic example of EXPLAIN usage:

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

This query is trying to find a node with a code property matching the provided value. Notice that we did not provide a label in the query. This is intentional to showcase how a query plan can be used to identify issues.

We can see from the following screenshot that the first step we are doing is AllNodesScan. What this means is that we are looking at the whole database to find the node we want and that we either have a mistake in the query or we are missing an index:

...