3.7.1. Starting point operators

These operators find parts of the graph from which to start.

Operators:

3.7.1.1. All Nodes Scan

Reads all nodes from the node store. The variable that will contain the nodes is seen in the arguments. If your query is using this operator, you are very likely to see performance problems on any non-trivial database.

Query. 

MATCH (n)
RETURN n

Query Plan. 

Compiler CYPHER 3.3

Planner COST

Runtime INTERPRETED

+-----------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------+
| Operator        | Estimated Rows | Rows | DB Hits | Page Cache Hits | Page Cache Misses | Page Cache Hit Ratio | Variables |
+-----------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------+
| +ProduceResults |             35 |   35 |       0 |              39 |                 0 |               1.0000 | n         |
| |               +----------------+------+---------+-----------------+-------------------+----------------------+-----------+
| +AllNodesScan   |             35 |   35 |      36 |              40 |                 0 |               1.0000 | n         |
+-----------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------+

Total database accesses: 36

3.7.1.2. Directed Relationship By Id Seek

Reads one or more relationships by id from the relationship store. Produces both the relationship and the nodes on either side.

Query. 

MATCH (n1)-[r]->()
WHERE id(r)= 0
RETURN r, n1

Query Plan. 

Compiler CYPHER 3.3

Planner COST

Runtime INTERPRETED

+-----------------------------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------------+-----------------------------------------------------------------------------------+
| Operator                          | Estimated Rows | Rows | DB Hits | Page Cache Hits | Page Cache Misses | Page Cache Hit Ratio | Variables       | Other                                                                             |
+-----------------------------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------------+-----------------------------------------------------------------------------------+
| +ProduceResults                   |              1 |    1 |       0 |               0 |                 0 |               0.0000 | anon[17], n1, r |                                                                                   |
| |                                 +----------------+------+---------+-----------------+-------------------+----------------------+-----------------+-----------------------------------------------------------------------------------+
| +DirectedRelationshipByIdSeekPipe |              1 |    1 |       1 |               1 |                 0 |               1.0000 | anon[17], n1, r | EntityByIdRhs(ManySeekableArgs(ListLiteral(List(Parameter(  AUTOINT0,Integer))))) |
+-----------------------------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------------+-----------------------------------------------------------------------------------+

Total database accesses: 1

3.7.1.3. Node by Id seek

Reads one or more nodes by id from the node store.

Query. 

MATCH (n)
WHERE id(n)= 0
RETURN n

Query Plan. 

Compiler CYPHER 3.3

Planner COST

Runtime INTERPRETED

+-----------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------+
| Operator        | Estimated Rows | Rows | DB Hits | Page Cache Hits | Page Cache Misses | Page Cache Hit Ratio | Variables |
+-----------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------+
| +ProduceResults |              1 |    1 |       0 |               0 |                 0 |               0.0000 | n         |
| |               +----------------+------+---------+-----------------+-------------------+----------------------+-----------+
| +NodeByIdSeek   |              1 |    1 |       1 |               1 |                 0 |               1.0000 | n         |
+-----------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------+

Total database accesses: 1

3.7.1.4. Node by label scan

Using the label index, fetches all nodes with a specific label on them from the node label index.

Query. 

MATCH (person:Person)
RETURN person

Query Plan. 

Compiler CYPHER 3.3

Planner COST

Runtime INTERPRETED

+------------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------+---------+
| Operator         | Estimated Rows | Rows | DB Hits | Page Cache Hits | Page Cache Misses | Page Cache Hit Ratio | Variables | Other   |
+------------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------+---------+
| +ProduceResults  |             14 |   14 |       0 |               0 |                 0 |               0.0000 | person    |         |
| |                +----------------+------+---------+-----------------+-------------------+----------------------+-----------+---------+
| +NodeByLabelScan |             14 |   14 |      15 |               1 |                 0 |               1.0000 | person    | :Person |
+------------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------+---------+

Total database accesses: 15

3.7.1.5. Node index seek

Finds nodes using an index seek. The node variable and the index used is shown in the arguments of the operator. If the index is a unique index, the operator is called NodeUniqueIndexSeek instead.

Query. 

MATCH (location:Location { name: 'Malmo' })
RETURN location

Query Plan. 

Compiler CYPHER 3.3

Planner COST

Runtime INTERPRETED

+-----------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------+-----------------+
| Operator        | Estimated Rows | Rows | DB Hits | Page Cache Hits | Page Cache Misses | Page Cache Hit Ratio | Variables | Other           |
+-----------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------+-----------------+
| +ProduceResults |              1 |    1 |       0 |               0 |                 0 |               0.0000 | location  |                 |
| |               +----------------+------+---------+-----------------+-------------------+----------------------+-----------+-----------------+
| +NodeIndexSeek  |              1 |    1 |       2 |               0 |                 0 |               0.0000 | location  | :Location(name) |
+-----------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------+-----------------+

Total database accesses: 2

3.7.1.6. Node index range seek

Finds nodes using an index seek where the value of the property matches a given prefix string. This operator can be used for STARTS WITH and comparators such as <, >, <= and >=

Query. 

MATCH (l:Location)
WHERE l.name STARTS WITH 'Lon'
RETURN l

Query Plan. 

Compiler CYPHER 3.3

Planner COST

Runtime INTERPRETED

+-----------------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------+---------------------------------------------+
| Operator              | Estimated Rows | Rows | DB Hits | Page Cache Hits | Page Cache Misses | Page Cache Hit Ratio | Variables | Other                                       |
+-----------------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------+---------------------------------------------+
| +ProduceResults       |             26 |    1 |       0 |               0 |                 0 |               0.0000 | l         |                                             |
| |                     +----------------+------+---------+-----------------+-------------------+----------------------+-----------+---------------------------------------------+
| +NodeIndexSeekByRange |             26 |    1 |       2 |               0 |                 0 |               0.0000 | l         | :Location(name STARTS WITH {  AUTOSTRING0}) |
+-----------------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------+---------------------------------------------+

Total database accesses: 2

3.7.1.7. Node index contains scan

An index contains scan goes through all values stored in an index, and searches for entries containing a specific string. This is slower than an index seek, since all entries need to be examined, but still faster than the indirection needed by a label scan and then a property store filter.

Query. 

MATCH (l:Location)
WHERE l.name CONTAINS 'al'
RETURN l

Query Plan. 

Compiler CYPHER 3.3

Planner COST

Runtime INTERPRETED

+------------------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------+----------------------------------+
| Operator               | Estimated Rows | Rows | DB Hits | Page Cache Hits | Page Cache Misses | Page Cache Hit Ratio | Variables | Other                            |
+------------------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------+----------------------------------+
| +ProduceResults        |             10 |    2 |       0 |               0 |                 0 |               0.0000 | l         |                                  |
| |                      +----------------+------+---------+-----------------+-------------------+----------------------+-----------+----------------------------------+
| +NodeIndexContainsScan |             10 |    2 |       3 |               0 |                 0 |               0.0000 | l         | :Location(name); {  AUTOSTRING0} |
+------------------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------+----------------------------------+

Total database accesses: 3

3.7.1.8. Node index scan

An index scan goes through all values stored in an index, and can be used to find all nodes with a particular label having a specified property (e.g. exists(n.prop)).

Query. 

MATCH (l:Location)
WHERE exists(l.name)
RETURN l

Query Plan. 

Compiler CYPHER 3.3

Planner COST

Runtime INTERPRETED

+-----------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------+-----------------+
| Operator        | Estimated Rows | Rows | DB Hits | Page Cache Hits | Page Cache Misses | Page Cache Hit Ratio | Variables | Other           |
+-----------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------+-----------------+
| +ProduceResults |             10 |   10 |       0 |               0 |                 0 |               0.0000 | l         |                 |
| |               +----------------+------+---------+-----------------+-------------------+----------------------+-----------+-----------------+
| +NodeIndexScan  |             10 |   10 |      11 |               0 |                 1 |               0.0000 | l         | :Location(name) |
+-----------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------+-----------------+

Total database accesses: 11

3.7.1.9. Undirected Relationship By Id Seek

Reads one or more relationships by id from the relationship store. For each relationship, two rows are produced with start and end nodes arranged differently.

Query. 

MATCH (n1)-[r]-()
WHERE id(r)= 1
RETURN r, n1

Query Plan. 

Compiler CYPHER 3.3

Planner COST

Runtime INTERPRETED

+---------------------------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------------+
| Operator                        | Estimated Rows | Rows | DB Hits | Page Cache Hits | Page Cache Misses | Page Cache Hit Ratio | Variables       |
+---------------------------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------------+
| +ProduceResults                 |              1 |    2 |       0 |               0 |                 0 |               0.0000 | anon[16], n1, r |
| |                               +----------------+------+---------+-----------------+-------------------+----------------------+-----------------+
| +UndirectedRelationshipByIdSeek |              1 |    2 |       1 |               1 |                 0 |               1.0000 | anon[16], n1, r |
+---------------------------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------------+

Total database accesses: 1