After the release of Neo4j 4.3 on June 17th, I wanted to test it during the weekend.

The schema of my Dataset

The relationship – HAS_RATINGS has count of number of podcast listeners, who have rated from 1 to 5 stars.

Query –

match (p:Podcast)-[ra:HAS_RATINGS]->(r1:Ratings) where ra.count>4 return p.name,ra.count,r1.id ;

Difference in profile

       Neo4j 4.2                                      Neo4j 4.3
 +------------------------+              +---------------------------------------------+                                 
 | Operator               |              | Operator                                    |
 +------------------------+              +---------------------------------------------+
 | +ProduceResults@neo4j  |              | +ProduceResults@neo4j                       |
 | |                      +              | |                                           +
 | +Projection@neo4j      |              | +Projection@neo4j                           |
 | |                      +              | |                                           +
 | +Filter@neo4j          |              | +Filter@neo4j                               |
 | |                      +              | |                                           +
 | +Expand(All)@neo4j     |              | +DirectedRelationshipIndexSeekByRange@neo4j |
 | |                      +              +---------------------------------------------+
 | +CacheProperties@neo4j |
 | |                      +
 | +NodeByLabelScan@neo4j |
 +------------------------+

As noted from the Profile difference, in Neo4j 4.2 there are 6 steps with Expand(All) and NodesScan, but in Neo4j 4.3 there are only 4 steps with Relationship Index.

Though the test database was a small dataset, I am trying to create a minimum of 1 GB dataset and test more.

A full detail Neo4j Profile from both 4.2 and 4.3

Neo4j 4.2 Profile

 +-----------------------------------------------------------------------+
 | Plan      | Statement   | Version      | Planner | Runtime     | Time |
 +-----------------------------------------------------------------------+
 | "EXPLAIN" | "READ_ONLY" | "CYPHER 4.2" | "COST"  | "PIPELINED" | 2    |
 +-----------------------------------------------------------------------+
 +------------------------+----------------------------------------------------------------------------+----------------+---------------------+
 | Operator               | Details                                                                    | Estimated Rows | Other               |
 +------------------------+----------------------------------------------------------------------------+----------------+---------------------+
 | +ProduceResults@neo4j  | p.name, ra.count, r1.id                                              |           1019 | Fused in Pipeline 0 |
 | |                      +----------------------------------------------------------------------------+----------------+---------------------+
 | +Projection@neo4j      | p.name AS p.name, cache[ra.count] AS ra.count, cache[r1.id] AS r1.id |           1019 | Fused in Pipeline 0 |
 | |                      +----------------------------------------------------------------------------+----------------+---------------------+
 | +Filter@neo4j          | cache[ra.count] > $autoint_0 AND p:Podcast                                 |           1019 | Fused in Pipeline 0 |
 | |                      +----------------------------------------------------------------------------+----------------+---------------------+
 | +Expand(All)@neo4j     | (r1)<-[ra:HAS_RATINGS]-(p)                                                 |           3397 | Fused in Pipeline 0 |
 | |                      +----------------------------------------------------------------------------+----------------+---------------------+
 | +CacheProperties@neo4j | cache[r1.id]                                                               |             10 | Fused in Pipeline 0 |
 | |                      +----------------------------------------------------------------------------+----------------+---------------------+
 | +NodeByLabelScan@neo4j | r1:Ratings                                                                 |             10 | Fused in Pipeline 0 |
 +------------------------+----------------------------------------------------------------------------+----------------+---------------------+
 +--------------------------------------------------------------------------------------------------------+
 | Plan      | Statement   | Version      | Planner | Runtime     | Time | DbHits | Rows | Memory (Bytes) |
 +--------------------------------------------------------------------------------------------------------+
 | "PROFILE" | "READ_ONLY" | "CYPHER 4.2" | "COST"  | "PIPELINED" | 3    | 17582  | 1781 | 72             |
 +--------------------------------------------------------------------------------------------------------+
 +------------------------+----------------------------------------------------------------------------+----------------+------+---------+----------------+---------------------+
 | Operator               | Details                                                                    | Estimated Rows | Rows | DB Hits | Memory (Bytes) | Other               |
 +------------------------+----------------------------------------------------------------------------+----------------+------+---------+----------------+---------------------+
 | +ProduceResults@neo4j  | p.name, ra.count, r1.id                                              |           1019 | 1781 |       0 |                | Fused in Pipeline 0 |
 | |                      +----------------------------------------------------------------------------+----------------+------+---------+----------------+---------------------+
 | +Projection@neo4j      | p.name AS p.name, cache[ra.count] AS ra.count, cache[r1.id] AS r1.id |           1019 | 1781 |    8904 |                | Fused in Pipeline 0 |
 | |                      +----------------------------------------------------------------------------+----------------+------+---------+----------------+---------------------+
 | +Filter@neo4j          | cache[ra.count] > $autoint_0 AND p:Podcast                                 |           1019 | 1781 |    5178 |                | Fused in Pipeline 0 |
 | |                      +----------------------------------------------------------------------------+----------------+------+---------+----------------+---------------------+
 | +Expand(All)@neo4j     | (r1)<-[ra:HAS_RATINGS]-(p)                                                 |           3397 | 3397 |    3407 |                | Fused in Pipeline 0 |
 | |                      +----------------------------------------------------------------------------+----------------+------+---------+----------------+---------------------+
 | +CacheProperties@neo4j | cache[r1.id]                                                               |             10 |    5 |      87 |                | Fused in Pipeline 0 |
 | |                      +----------------------------------------------------------------------------+----------------+------+---------+----------------+---------------------+
 | +NodeByLabelScan@neo4j | r1:Ratings                                                                 |             10 |    5 |       6 |             72 | Fused in Pipeline 0 |
 +------------------------+----------------------------------------------------------------------------+----------------+------+---------+----------------+---------------------+

Neo4j 4.3 (with Relationship Count indexed)

+-----------------------------------------------------------------------+
 | Plan      | Statement   | Version      | Planner | Runtime     | Time |
 +-----------------------------------------------------------------------+
 | "EXPLAIN" | "READ_ONLY" | "CYPHER 4.3" | "COST"  | "PIPELINED" | 4    |
 +-----------------------------------------------------------------------+
 +---------------------------------------------+-----------------------------------------------------------------------------+----------------+---------------------+
 | Operator                                    | Details                                                                     | Estimated Rows | Other               |
 +---------------------------------------------+-----------------------------------------------------------------------------+----------------+---------------------+
 | +ProduceResults@neo4j                       | p.name, ra.count, r1.id                                               |            101 | Fused in Pipeline 0 |
 | |                                           +-----------------------------------------------------------------------------+----------------+---------------------+
 | +Projection@neo4j                           | p.name AS p.name, cache[ra.count] AS ra.count, r1.id AS r1.id         |            101 | Fused in Pipeline 0 |
 | |                                           +-----------------------------------------------------------------------------+----------------+---------------------+
 | +Filter@neo4j                               | p:Podcast AND r1:Ratings                                                    |            101 | Fused in Pipeline 0 |
 | |                                           +-----------------------------------------------------------------------------+----------------+---------------------+
 | +DirectedRelationshipIndexSeekByRange@neo4j | (p)-[ra:HAS_RATINGS(count)]->(r1) WHERE count > $autoint_0, cache[ra.count] |            101 | Fused in Pipeline 0 |
 +---------------------------------------------+-----------------------------------------------------------------------------+----------------+---------------------+
 +--------------------------------------------------------------------------------------------------------+
 | Plan      | Statement   | Version      | Planner | Runtime     | Time | DbHits | Rows | Memory (Bytes) |
 +--------------------------------------------------------------------------------------------------------+
 | "PROFILE" | "READ_ONLY" | "CYPHER 4.3" | "COST"  | "PIPELINED" | 22   | 21127  | 1781 | 136            |
 +--------------------------------------------------------------------------------------------------------+
 +---------------------------------------------+-----------------------------------------------------------------------------+----------------+------+---------+----------------+------------------------+-----------+---------------------+
 | Operator                                    | Details                                                                     | Estimated Rows | Rows | DB Hits | Memory (Bytes) | Page Cache Hits/Misses | Time (ms) | Other               |
 +---------------------------------------------+-----------------------------------------------------------------------------+----------------+------+---------+----------------+------------------------+-----------+---------------------+
 | +ProduceResults@neo4j                       | p.name, ra.count, r1.id                                               |            101 | 1781 |       0 |                |                        |           | Fused in Pipeline 0 |
 | |                                           +-----------------------------------------------------------------------------+----------------+------+---------+----------------+------------------------+-----------+---------------------+
 | +Projection@neo4j                           | p.name AS p.name, cache[ra.count] AS ra.count, r1.id AS r1.id         |            101 | 1781 |   14002 |                |                        |           | Fused in Pipeline 0 |
 | |                                           +-----------------------------------------------------------------------------+----------------+------+---------+----------------+------------------------+-----------+---------------------+
 | +Filter@neo4j                               | p:Podcast AND r1:Ratings                                                    |            101 | 1781 |    3562 |                |                        |           | Fused in Pipeline 0 |
 | |                                           +-----------------------------------------------------------------------------+----------------+------+---------+----------------+------------------------+-----------+---------------------+
 | +DirectedRelationshipIndexSeekByRange@neo4j | (p)-[ra:HAS_RATINGS(count)]->(r1) WHERE count > $autoint_0, cache[ra.count] |            101 | 1781 |    3563 |             72 |                 7875/6 |    18.263 | Fused in Pipeline 0 |
 +---------------------------------------------+-----------------------------------------------------------------------------+----------------+------+---------+----------------+------------------------+-----------+---------------------+

 401 total views,  2 views today

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.