# Execution time of cypher query

**URL:** <https://community.neo4j.com/t/execution-time-of-cypher-query/10674>\
**Category:** Cypher\
**Tags:** cypher\
**Created:** [October 4, 2019, 5:27am UTC](https://community.neo4j.com/t/execution-time-of-cypher-query/10674 "2019-10-04T05:27:54Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![vamsi.join](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/vamsi.join/32/6708_2.png) [@vamsi.join](https://community.neo4j.com/u/vamsi.join)\
**Post date:** [October 4, 2019, 5:27am UTC](https://community.neo4j.com/t/execution-time-of-cypher-query/10674/1 "2019-10-04T05:27:54Z")

</div>

Hi,  
Thnx in advance if anyone help me with this.  
I am trying to compare the execution times of RDBMS and Neo4j Queries, how can I get the execution time in Neo4j.

---

<div class="post-metadata">

**Author:** ![andrew\_bowman](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/andrew_bowman/32/73_2.png) [@andrew\_bowman](https://community.neo4j.com/u/andrew_bowman)\
**Post date:** [October 4, 2019, 9:44am UTC](https://community.neo4j.com/t/execution-time-of-cypher-query/10674/2 "2019-10-04T09:44:17Z")

</div>

If you have enterprise edition, you can turn on [query logging](https://neo4j.com/docs/operations-manual/current/monitoring/logging/query-logging/), and if you like you can also enable additional options to track how the time is distributed throughout the execution process.

Keep in mind that at least the first run of the query may be slower than subsequent runs, as the query will have to be planned, and the part of the graph touched may not be in the pagecache. We recommend discarding the first execution time, then running the query a few times to get the min or average, depending on what you're going for.

Also you'll want to make sure you have indexes (or unique constraints) in place to support fast lookup of your starting nodes.

---

<div class="post-metadata">

**Author:** ![nlaquan](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/nlaquan/32/6719_2.png) [@nlaquan](https://community.neo4j.com/u/nlaquan)\
**Post date:** [October 4, 2019, 11:42am UTC](https://community.neo4j.com/t/execution-time-of-cypher-query/10674/3 "2019-10-04T11:42:27Z")

</div>

In neo4j, there are two options to choose from when you want to analyze a query. It is **explain** and **profile**. I think you should take a look at those links:  
[https://neo4j.com/docs/cypher-manual/current/query-tuning/how-do-i-profile-a-query/](https://neo4j.com/docs/cypher-manual/current/query-tuning/how-do-i-profile-a-query/)

> **[Basic query tuning example - Cypher Manual](https://neo4j.com/docs/cypher-manual/current/query-tuning/basic-example/)**
>
> Example how to profile a query, by using optimizations based on native index capabilities.

> **[Execution plans - Cypher Manual](https://neo4j.com/docs/cypher-manual/current/execution-plans/)**
>
> Characteristics of query execution plans and provides details about each of the operators.

to determine the execution time of a query in neo4j.

---

<div class="post-metadata">

**Author:** ![md7](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/md7/32/7618_2.png) [@md7](https://community.neo4j.com/u/md7)\
**Post date:** [December 7, 2020, 6:46am UTC](https://community.neo4j.com/t/execution-time-of-cypher-query/10674/4 "2020-12-07T06:46:52Z")

</div>

Query logging page url: [Logging - Operations Manual](https://neo4j.com/docs/operations-manual/current/monitoring/logging/)

---

<div class="post-metadata">

**Author:** ![clem](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/clem/32/4364_2.png) [@clem](https://community.neo4j.com/u/clem)\
**Post date:** [December 7, 2020, 4:23pm UTC](https://community.neo4j.com/t/execution-time-of-cypher-query/10674/5 "2020-12-07T16:23:19Z")

</div>

BTW, there are lots of tricks/techniques to optimize Cypher Queries.

See:

> [@Best practices for queries that can take hours to complete](https://community.neo4j.com/t/best-practices-for-queries-that-can-take-hours-to-complete/29666/5):
>
> Another link on query optimizations: I wasn't clearly your question on time out... But if you set the timeout to 0, it won't timeout:

---

<div class="post-metadata">

**Author:** ![samasamaan](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/samasamaan/32/16813_2.png) [@samasamaan](https://community.neo4j.com/u/samasamaan)\
**Post date:** [December 26, 2021, 8:13pm UTC](https://community.neo4j.com/t/execution-time-of-cypher-query/10674/6 "2021-12-26T20:13:46Z")

</div>

Hello mates  
I'm trying to find the execution time of GDS algorithms using **community edition** of Neo4j. Is there any way to find it rather than query logging? Since this facility is specific to enterprise edition as shown in this topic.  
I found this site [[neo4j - How to get the execution time of a cypher query from python? - Stack Overflow](https://stackoverflow.com/questions/49859311/how-to-get-the-execution-time-of-a-cypher-query-from-python)] is it helpful ??  
Update:  
Can I rely on this to estimates query execution time?  
Note: this is an example of executing shortest path algorithm:  
 ![image](https://us1.discourse-cdn.com/flex021/uploads/neo4jcommunity/original/3X/3/7/37259410da7a94c7163e5fe5e5bbc1f0be2399db.png)
