# \#optimization

**URL:** https://community.neo4j.com/tag/optimization/37.md

[Latest](https://community.neo4j.com/latest.md) · [Categories](https://community.neo4j.com/categories.md) · [Tags](https://community.neo4j.com/tags.md)

---

## [Optimising the cypher query](https://community.neo4j.com/t/optimising-the-cypher-query/76517)

<div class="topic-metadata">

**Author:** [@anshulchaintha7](https://community.neo4j.com/u/anshulchaintha7)\
**Replies:** 8\
**Last updated:** [May 21, 2026, 10:49am UTC](https://community.neo4j.com/t/optimising-the-cypher-query/76517 "2026-05-21T10:49:14Z")

</div>

I have a query that fetches that the information from a specific traversal path. It builds a path in a specific format by fetching tag from each node in this manner A/b/c/d Okay now the query is working well on neo4j b…

---

## [Questions about my query model](https://community.neo4j.com/t/questions-about-my-query-model/72813)

<div class="topic-metadata">

**Author:** [@victor](https://community.neo4j.com/u/victor)\
**Replies:** 13\
**Last updated:** [March 6, 2025, 5:07pm UTC](https://community.neo4j.com/t/questions-about-my-query-model/72813 "2025-03-06T17:07:56Z")

</div>

Hi folks, I am building a Graph API where I can get nodes and edges subsequently in the same request. I am having a bit of trouble trying to optimize this query (please ignore literal values as I replace them with param…

---

## [How to perform profiling on Composite DB Cypher Queries?](https://community.neo4j.com/t/how-to-perform-profiling-on-composite-db-cypher-queries/67511)

<div class="topic-metadata">

**Author:** [@shrish.tiwari](https://community.neo4j.com/u/shrish.tiwari)\
**Replies:** 1\
**Last updated:** [April 30, 2024, 3:31pm UTC](https://community.neo4j.com/t/how-to-perform-profiling-on-composite-db-cypher-queries/67511 "2024-04-30T15:31:50Z")

</div>

I have been working with Composite Databases on Neo4j in my local system. While running some queries, I encountered the "Neo.TransientError.General.MemoryPoolOutOfMemoryError." I know that increasing the transaction memo…

---

## [Multiple matches in a single query vs single match in multiple queries](https://community.neo4j.com/t/multiple-matches-in-a-single-query-vs-single-match-in-multiple-queries/62076)

<div class="topic-metadata">

**Author:** [@aman.negi](https://community.neo4j.com/u/aman.negi)\
**Replies:** 5\
**Last updated:** [April 18, 2023, 5:30am UTC](https://community.neo4j.com/t/multiple-matches-in-a-single-query-vs-single-match-in-multiple-queries/62076 "2023-04-18T05:30:04Z")

</div>

Hey community folks, I had a doubt in implementing a query to fetch details related to a node. this my schema : I want fetch the details of a patent, I wrote a query for that as follows : match (p:PATENT {app\_num …

---

## [Simplify/optimizing my query (removing UNION)](https://community.neo4j.com/t/simplify-optimizing-my-query-removing-union/61356)

<div class="topic-metadata">

**Author:** [@tbigraph.cloud](https://community.neo4j.com/u/tbigraph.cloud)\
**Replies:** 3\
**Last updated:** [March 22, 2023, 7:41am UTC](https://community.neo4j.com/t/simplify-optimizing-my-query-removing-union/61356 "2023-03-22T07:41:30Z")

</div>

Hello, I wrote a cypher query in Neo4J 4.4 which works as expected. Its objective is: from a start node, identified by an id (p) returns all connected nodes (p2) of a type linked by relationship with specific conditi…

---

## [How to optimize the performance of scanning edge data](https://community.neo4j.com/t/how-to-optimize-the-performance-of-scanning-edge-data/58625)

<div class="topic-metadata">

**Author:** [@czp](https://community.neo4j.com/u/czp)\
**Replies:** 2\
**Last updated:** [November 28, 2022, 6:26am UTC](https://community.neo4j.com/t/how-to-optimize-the-performance-of-scanning-edge-data/58625 "2022-11-28T06:26:00Z")

</div>

I have a graph that has 80 million vertexes and 30 million edges. I need to scan all the edge data, including the ids of its starting and ending vertexes.But the performance is poor and I need to optimize it. This is my…

---

## [Neo4j and optimization](https://community.neo4j.com/t/neo4j-and-optimization/58865)

<div class="topic-metadata">

**Author:** [@Avi](https://community.neo4j.com/u/Avi)\
**Replies:** 0\
**Last updated:** [November 3, 2022, 6:30pm UTC](https://community.neo4j.com/t/neo4j-and-optimization/58865 "2022-11-03T18:30:37Z")

</div>

I'm newbie to neo4j and I'm trying to asses of new4j can solve simple optimization use case. in the use case there are 4 products with demand as a property and 4 supplier with a cost of crude oil as a property. each s…

---

## [What's a better way to search/compare list elements? any() function](https://community.neo4j.com/t/whats-a-better-way-to-search-compare-list-elements-any-function/56202)

<div class="topic-metadata">

**Author:** [@jo\_nathan](https://community.neo4j.com/u/jo_nathan)\
**Replies:** 9\
**Last updated:** [May 31, 2022, 1:09pm UTC](https://community.neo4j.com/t/whats-a-better-way-to-search-compare-list-elements-any-function/56202 "2022-05-31T13:09:48Z")

</div>

TL;DR Comparing array elements is inefficient - how to improve? Should I use a proper programming language? Which can be recommended? MATCH (a:example\_label),(b:example\_label) WHERE any(temp IN a.list WHERE temp IN b.l…

---

## [Qyery takes too much and fail after 2 hours of compiling](https://community.neo4j.com/t/qyery-takes-too-much-and-fail-after-2-hours-of-compiling/49682)

<div class="topic-metadata">

**Author:** [@wadie.almouhtadi](https://community.neo4j.com/u/wadie.almouhtadi)\
**Replies:** 5\
**Last updated:** [January 5, 2022, 1:48am UTC](https://community.neo4j.com/t/qyery-takes-too-much-and-fail-after-2-hours-of-compiling/49682 "2022-01-05T01:48:27Z")

</div>

so i'm running the following query on 500k nodes: load csv with headers from 'file:///df\_keyword\_urls.csv' as row with collect({keyword:row.keyword , urls:row.urls}) as ROW unwind ROW as k1 unwind ROW as k2 …

---

## [Optimize Neo4j cypher query on huge dataset](https://community.neo4j.com/t/optimize-neo4j-cypher-query-on-huge-dataset/49118)

<div class="topic-metadata">

**Author:** [@annthomy.gilles](https://community.neo4j.com/u/annthomy.gilles)\
**Replies:** 3\
**Last updated:** [December 20, 2021, 11:32am UTC](https://community.neo4j.com/t/optimize-neo4j-cypher-query-on-huge-dataset/49118 "2021-12-20T11:32:31Z")

</div>

The following query can't run on a dataset with ~2M nodes. What should i do to make it run faster? MATCH (cc:ConComp)-\[r1:IN\_CONCOMP\]-(p1:Person)-\[r2:SAME\_CLUSTER\]-(p2:Person) WHERE cc.cluster\_type = "househ…

---

## [How to explicitly specify join orders for query planning?](https://community.neo4j.com/t/how-to-explicitly-specify-join-orders-for-query-planning/13256)

<div class="topic-metadata">

**Author:** [@syko](https://community.neo4j.com/u/syko)\
**Replies:** 2\
**Last updated:** [December 9, 2021, 7:26am UTC](https://community.neo4j.com/t/how-to-explicitly-specify-join-orders-for-query-planning/13256 "2021-12-09T07:26:25Z")

</div>

Hi, I am new to neo4j and have some questions I am evaluating the query performance under different join orders (query is written in Cypher) According to Neo4j manual, I can input several hints such as index, scan, and…

---

## [Tuning of cypher queries for List operations](https://community.neo4j.com/t/tuning-of-cypher-queries-for-list-operations/43628)

<div class="topic-metadata">

**Author:** [@dhanashree.murge](https://community.neo4j.com/u/dhanashree.murge)\
**Replies:** 3\
**Last updated:** [September 2, 2021, 8:01am UTC](https://community.neo4j.com/t/tuning-of-cypher-queries-for-list-operations/43628 "2021-09-02T08:01:25Z")

</div>

I have imported one RDF file in Neo4J using NeoSemantics. Total no of nodes : 1071461 (1 Million) Total Relationships : 2553482 (2.5 Million) When I query this imported graph for traversal queries, I usually get execu…

---

## [How can I optimize my Cypher Queries?](https://community.neo4j.com/t/how-can-i-optimize-my-cypher-queries/114)

<div class="topic-metadata">

**Author:** [@michael.hunger](https://community.neo4j.com/u/michael.hunger)\
**Replies:** 4\
**Last updated:** [February 9, 2021, 10:09am UTC](https://community.neo4j.com/t/how-can-i-optimize-my-cypher-queries/114 "2021-02-09T10:09:29Z")

</div>

What should I do if my Cypher query is slower than expected, or uses more memory or CPU than I have? I'm running my queries with Neo4j Browser, copied from my application. What should I do? Are there any good practices…

---

## [Simplify graph by removing "unnecessary" nodes from graph and result](https://community.neo4j.com/t/simplify-graph-by-removing-unnecessary-nodes-from-graph-and-result/32995)

<div class="topic-metadata">

**Author:** [@d.c.bouter](https://community.neo4j.com/u/d.c.bouter)\
**Replies:** 3\
**Last updated:** [February 1, 2021, 4:38pm UTC](https://community.neo4j.com/t/simplify-graph-by-removing-unnecessary-nodes-from-graph-and-result/32995 "2021-02-01T16:38:36Z")

</div>

Hi! Having serious fun exploring the possibility of using Neo4j for my companies analytical needs. I'm currently working on the following problem. I have a somewhat polluted topology. some paths between two nodes of in…

---

## [Need to optimize Neo4j Query](https://community.neo4j.com/t/need-to-optimize-neo4j-query/31708)

<div class="topic-metadata">

**Author:** [@gautam.kapoor](https://community.neo4j.com/u/gautam.kapoor)\
**Replies:** 1\
**Last updated:** [January 9, 2021, 10:49pm UTC](https://community.neo4j.com/t/need-to-optimize-neo4j-query/31708 "2021-01-09T22:49:52Z")

</div>

Hi, I am creating a social media app whose back-end is Neo4j. Here, I want to fetch friends activities on user's homepage. I have put a limit of 10 activities per scroll. This is my current Neo4j Query: MATCH (m:Perso…

---

## [How to fix the un-optimal behavior of query engine](https://community.neo4j.com/t/how-to-fix-the-un-optimal-behavior-of-query-engine/31654)

<div class="topic-metadata">

**Author:** [@michalkomorowski1984](https://community.neo4j.com/u/michalkomorowski1984)\
**Replies:** 4\
**Last updated:** [January 8, 2021, 7:40am UTC](https://community.neo4j.com/t/how-to-fix-the-un-optimal-behavior-of-query-engine/31654 "2021-01-08T07:40:39Z")

</div>

Context: We have users. Users can be members of groups. Groups belong to tenants. Tenants = business context. Tenants form a hierarchy. Query Now we have the following simplified query: PROFILE MATCH (u:User {Id:…

---

## [Relation Type containing a Date - Optimization](https://community.neo4j.com/t/relation-type-containing-a-date-optimization/18174)

<div class="topic-metadata">

**Author:** [@maxime.blais](https://community.neo4j.com/u/maxime.blais)\
**Replies:** 3\
**Last updated:** [December 16, 2020, 7:12pm UTC](https://community.neo4j.com/t/relation-type-containing-a-date-optimization/18174 "2020-12-16T19:12:52Z")

</div>

Hey guys I have this model: CREATE (myInfo:Info {hash:'some hash'}) CREATE (Keanu:User {name:'Keanu Reeves'}) CREATE (Keanu)- \[:INFO\_DETECTED\_ON\_2020\_05\_04\] - \>(myInfo); I want to be able to retrieve relation based on …

---

## [Query optimization](https://community.neo4j.com/t/query-optimization/30499)

<div class="topic-metadata">

**Author:** [@bratanic\_tomaz](https://community.neo4j.com/u/bratanic_tomaz)\
**Replies:** 2\
**Last updated:** [December 16, 2020, 3:49pm UTC](https://community.neo4j.com/t/query-optimization/30499 "2020-12-16T15:49:57Z")

</div>

I have the following query: MATCH (drug)-\[r1:INHIBITS|DISRUPTS|INTERACTS\_WITH\]-\>(c2)-\[r2:CAUSES|ASSOCIATED\_WITH|PREDISPOSES|AUGMENTS|AFFECTS\]-\>(covid:Concept) USING INDEX covid:Concept(cui) where drug.cui in \["C0031853"…

---

## [200 mio nodes what is slowing down this query and causes this error Neo.TransientError.General.OutOfMemoryError](https://community.neo4j.com/t/200-mio-nodes-what-is-slowing-down-this-query-and-causes-this-error-neo-transienterror-general-outofmemoryerror/25899)

<div class="topic-metadata">

**Author:** [@sinan](https://community.neo4j.com/u/sinan)\
**Replies:** 8\
**Last updated:** [September 30, 2020, 1:40pm UTC](https://community.neo4j.com/t/200-mio-nodes-what-is-slowing-down-this-query-and-causes-this-error-neo-transienterror-general-outofmemoryerror/25899 "2020-09-30T13:40:19Z")

</div>

Dear community I have issues with performance of the graph and queries when dealing with many millions of nodes. The goal is probably to be able to handle billions of nodes later after this PoC. I have a larger query …

---

## [Optimizing a query against GTFS data](https://community.neo4j.com/t/optimizing-a-query-against-gtfs-data/21615)

<div class="topic-metadata">

**Author:** [@nathanschepers](https://community.neo4j.com/u/nathanschepers)\
**Replies:** 0\
**Last updated:** [July 14, 2020, 2:29pm UTC](https://community.neo4j.com/t/optimizing-a-query-against-gtfs-data/21615 "2020-07-14T14:29:30Z")

</div>

I have a working query to help me find transit routes. It seems to take a long time to run, and the plan looks a bit asymmetrical to me, but I'm hardly an expert. Any ideas on how to optimize this? Here's my query: PRO…

---

## [List lookup vs index property lookup](https://community.neo4j.com/t/list-lookup-vs-index-property-lookup/17296)

<div class="topic-metadata">

**Author:** [@pieterpaul.strybol](https://community.neo4j.com/u/pieterpaul.strybol)\
**Replies:** 2\
**Last updated:** [April 27, 2020, 8:32am UTC](https://community.neo4j.com/t/list-lookup-vs-index-property-lookup/17296 "2020-04-27T08:32:28Z")

</div>

Hi all, I am struggling with an optimization of my Graph Model and I was hoping you could help me! All cypher query results and profiles have been performed on Neo4j Desktop 1.2.7 and Neo4j 4.0.3 I have a graph model…

---

## [Faster alternatives to \`Index + Params + Where IN\` for node lookup?](https://community.neo4j.com/t/faster-alternatives-to-index-params-where-in-for-node-lookup/13404)

<div class="topic-metadata">

**Author:** [@michael.j.hirn](https://community.neo4j.com/u/michael.j.hirn)\
**Replies:** 3\
**Last updated:** [January 7, 2020, 2:09pm UTC](https://community.neo4j.com/t/faster-alternatives-to-index-params-where-in-for-node-lookup/13404 "2020-01-07T14:09:13Z")

</div>

We are using the follow Cypher query: MATCH (n:Entity)-\[r\]-\>(m) WHERE n.cid IN $cids RETURN labels(n), n, type(r), m" There is a UNIQUE INDEX CONSTRAINT on Entity.cid $cids is a param which is a list of cids (in the …

---

## [Optimize concurrency and batch size with apoc.periodic.iterate()](https://community.neo4j.com/t/optimize-concurrency-and-batch-size-with-apoc-periodic-iterate/9039)

<div class="topic-metadata">

**Author:** [@holdsworthtimmy](https://community.neo4j.com/u/holdsworthtimmy)\
**Replies:** 1\
**Last updated:** [July 26, 2019, 1:20pm UTC](https://community.neo4j.com/t/optimize-concurrency-and-batch-size-with-apoc-periodic-iterate/9039 "2019-07-26T13:20:28Z")

</div>

How does one optimize the concurrency (and batch\_size) parameters with apoc.periodic.iterate()? Is there some rule of thumb for parallelizing with respect to the number of cores on my machine or available RAM? Any help …

---

## [Timestamp vs localedatetime](https://community.neo4j.com/t/timestamp-vs-localedatetime/5546)

<div class="topic-metadata">

**Author:** [@neo4j](https://community.neo4j.com/u/neo4j)\
**Replies:** 5\
**Last updated:** [March 12, 2019, 3:55pm UTC](https://community.neo4j.com/t/timestamp-vs-localedatetime/5546 "2019-03-12T15:55:28Z")

</div>

Hello everyone, I would like to know, in terms of perfomance, which one is the most optimise query and if there is any drawback. 1551966636 \<= this\_one.date\_as\_a\_timestamp \<= 1551988636 or localedatetime(yesterday)\<=…

---

## [Optimisation of a cypher query](https://community.neo4j.com/t/optimisation-of-a-cypher-query/4680)

<div class="topic-metadata">

**Author:** [@smuessemeier](https://community.neo4j.com/u/smuessemeier)\
**Replies:** 3\
**Last updated:** [January 29, 2019, 6:10pm UTC](https://community.neo4j.com/t/optimisation-of-a-cypher-query/4680 "2019-01-29T18:10:49Z")

</div>

Hello, we are doing database tests with different databases on connected data. Surprisingly Neo4J is somewhat slow compared to JDO Datanucleus. In our tests we have around 1.1 mio node, we aim for much bigger datasets (…
