# Apoc.meta.subgraph slow in neo4j5 vs neo4j 3?

**URL:** <https://community.neo4j.com/t/apoc-meta-subgraph-slow-in-neo4j5-vs-neo4j-3/65469>\
**Category:** Procedures & APOC\
**Created:** [December 21, 2023, 10:14pm UTC](https://community.neo4j.com/t/apoc-meta-subgraph-slow-in-neo4j5-vs-neo4j-3/65469 "2023-12-21T22:14:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kiran](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/kiran/32/29093_2.png) [@kiran](https://community.neo4j.com/u/kiran)\
**Post date:** [December 21, 2023, 10:14pm UTC](https://community.neo4j.com/t/apoc-meta-subgraph-slow-in-neo4j5-vs-neo4j-3/65469/1 "2023-12-21T22:14:16Z")

</div>

We have a neo4j 3 database that we just migrated to neo4j 5. So the number of nodes, relationships etc are exactly the same  
We are now at neo4j 5.9 apoc and database. Server specs are more (more cpu and ram) for the neo4 5.9 instance

The apoc.meta.subgraph is extremely fast in neo4j 3 - like instant under 100ms, but it takes up to 7 seconds in neo4j 5.9

We are using this to figure out how nodes are connected to each other and the path between them - So given a start node, and an end node - how are they connected

CALL apoc.meta.subGraph({labels:[StartNode,EndNode,PathMustIncludeThisNode], excludes:[]})

Appreciate any input you may have.
