Performance issue after upgrading neo4j v4 to v5

We have noticed some performance issues after migrating from Neo4j version 4 to version 5.
I have reviewed the indexing, and it appears to be the same as before.

Could you please suggest any solutions or steps we can follow to improve performance and optimize the overall application?

Thank you in advance for your assistance.

@zil.darji

are there any further details

  • what Neo4j v4.x did you previously run?
  • what version of Neo4j v5 did you upgrade to?
  • is this for all queries are slower or specific queries? if specific can you share cypher and plan from the v4 experience vs the v5 experience?

@dana_canzano ,

  • what Neo4j v4.x did you previously run?: 4.4.5
  • what version of Neo4j v5 did you upgrade to?: 5.26.0
  • All queries

@zil.darji

is there any detail of how much performance decreased? i.e. under 4.4.5 the query ran in 100ms but under 5.26.0 it ran in ??? ms?

did you migrate to block format? Store formats - Operations Manual ?

Hi @dana_canzano, I'm not entirely sure about the exact timing, as it varies depending on the queries. For example, queries that previously took around 100ms are now taking approximately 150ms, and those that took 1.2s are now taking around 2.5s.

During the migration process, I took a dump from the older version of the database and simply imported it into the newer version. I also updated the Neo4j driver package to the latest version for Node.js (v5.28.0).

So, if I'm not mistaken, it's performing a default block format migration.

@zil.darji

cypher statement

show DATABASE yield name, store;

will report the database name and record format. Does this report block?

@dana_canzano

I ran the following Cypher query to check the database configuration:

SHOW DATABASES YIELD name, store;

The result shows that both the neo4j and system databases are using the record-aligned-1.1 store format, which is expected and aligns with the standard format used in Neo4j 5.x.

╒════════╀════════════════════╕
β”‚name    β”‚store               β”‚
β•žβ•β•β•β•β•β•β•β•β•ͺ════════════════════║
β”‚"neo4j" β”‚"record-aligned-1.1"β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚"system"β”‚"record-aligned-1.1"β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

@zil.darji

The result shows that both the neo4j and system databases are using the record-aligned-1.1 store format, which is expected and aligns with the standard format used in Neo4j 5.x.

ok. but this is in contrast to your prior comment of

@dana_canzano

Yes, you're right β€” I made a mistake in my earlier comment as I wasn’t fully aware of the store format details at that time.

Now that I understand it better, I’d like to clarify β€” is the store format actually contributing to the performance issue we’re seeing?

Also, could you please advise whether using the store type block format (if available) would be more efficient, or is the current record-aligned-1.1 format already the most optimal in terms of performance?

I’d appreciate your suggestion on this so we can explore any potential improvements.

@zil.darji

You shouldnt have to migrate to block as performance from v4 to v5 should be equivalent if not better. However moving to block may introduce better performance.

So back to why is v4 'faster' than v5? Do you still have the v4 environment available such that you could compare.

    a. conf/neo4j.conf setting, specifically related to `dbms.memory*`  
       or `server.memory*`

    b. can you preface a know query with performance concerns 
        with `PROFILE` and compare the query plans?

@dana_canzano I tried changing the database store format from "aligned" to "blocks" in my local environment, but I didn’t observe any significant improvement in query performance. Also, I currently don’t have access to a v4 environmentβ€”otherwise, I would have tested it there as well.

Hi @dana_canzano ,

While upgrading the database version, I also updated the Neo4j driver to the latest version. My project uses GraphQL as well, and I'm currently running it on Node.js v16.4.2.

I’m wonderingβ€”could the issue be related to the older versions of the GraphQL-related packages? Here’s what I’m currently using:

"express-graphql": "^0.12.0",
"graphql": "^14.7.0",
"graphql-tools": "^7.0.1",
"neo4j-driver": "^5.28.0",
"neo4j-graphql-js": "^2.14.3"

Is it possible that this version mismatchβ€”especially with the older GraphQL librariesβ€”might be contributing to the issue?