title: How to get the execution time of a cypher query from python?
body: <p>I am trying to compare get the execution time of a Cypher query from python, i.e. the time required to compute on the neo4j-server (not including the time required output the result). Right now I am using the following code:</p>
  
  <pre><code>from neo4j.v1 import 
  driver = GraphDatabase.driver('bolt://localhost:7687', auth=('neo4j', '1234'))
  
  n_repeats = 3
  cypher = "MATCH (a) -[:{}*]- (b) WHERE ID(a) &lt; ID(b) RETURN DISTINCT a, b".format(graphname + '_edges')
  
  with driver.session() as session:
      total_time = 0
      for _ in range(n_repeats):
          with session.begin_transaction() as tx:
              start = time.time()
              tx.run(cypher)
              total_time += time.time() - start
  
  avg_time = total_time*1000 / n_repeats
  print('Average execution time:', avg_time, 'ms')
  </code></pre>
  
  <p>Is there a better way to time the execution time of a cypher query? In postgresql for instance there is the EXPLAIN ANALYZE statement, which also provides the time required to execute a SQL query. In Cypher there are EXPLAIN and PROFILE statements, but both seemingly don't return specific times. </p>
  
  <p>I am using neo4j-driver to connect to neo4j right now, but I would be willing to switch to another library.</p>