Unfortunately, there are many reasons that performance could be suffering, be it instance size, data not in buffer cache, instance size, concurrent processes, query optimization, etc. so it is hard to provide specific suggestions with the information available.
To better understand the issue, I'd suggest taking a look at how the query is being processed. These details can be found using the [openCypher explain feature] which will provide low-level details on what the query is doing and where the time is being spent. If possible, I suggest opening a support case with AWS support.
Based on the additional information you provided, I attempted to reproduce what you are seeing, but the query you have posted above on a graph with 10k 1-1 disconnected subgraphs takes ~200ms on a
t4g instance. I suspect you may be hitting a supernode or something similar within your data, but without the additional information in the explain plan this is just a guess.
In general, the performance of the
t4 instances will suffer from the lack of statistics generation (reference here) which the DFE query optimizer uses to optimize the query plan. These are disabled for these instances due to memory restrictions. In addition to the statistics, the DFE engine that runs openCypher will also benefit from the additional vCPUs of larger instances as it parallelizes the queries. e.g. I tried the same query/data on an
r6g.large and it ran in ~70ms.
Gremlin Query to count Edges - MemoryLimitExceededException AWS Neptuneasked 2 years ago
How to use bolt protocol in java to directly execute cypher query in AWS Neptune Serviceasked 2 months ago
Multi-tenancy in Neptuneasked 8 months ago
Connecting Neptune with OpenSearchasked 2 months ago
Support for Opensearch queries for Neptune nodes using OpenCypherasked 4 months ago
Neptune and Cypher - Poor Query Performanceasked 7 days ago
Expected performance / Limitations of AWS Neptune graph with millions of edgesasked 3 months ago
Does neptune db support APOC library from cypher?asked 3 months ago
Can I use the ID of my saved query to start query execution in Athena SDK?asked 4 months ago
Neptune PerformanceAccepted Answerasked 8 months ago