2016-12-30 51 views
2

我試圖找出我的Java驅動程序的Cypher查詢的執行時間。的Cypher查詢執行時間與Neo4j的Java驅動程序

Session session = driver.session(); 
session.run("CREATE (a:Person {name:'Arthur', title:'King'})"); 
StatementResult result = session.run("Profile MATCH (a:Person) WHERE a.name = 'Arthur' RETURN a.name AS name, a.title AS title"); 

但我不能在StatementResultResultSummary,這是由StatementResult.consume(query)返回的任何地方找到它。

我可以從ProfiledPlan訪問db命中ResultSummary,但沒有關於時間的信息。

有什麼辦法,我可以用Neo4j的Java驅動程序訪問的Cypher查詢執行時間?

+0

嗨,你能簡單地告訴我什麼'a'在創建人之前CREATE(a:Person ...'代表,我一直都在看它,它是否類似於JPQL – qualebs

回答

2

由於Neo4j的Java驅動程序版本1.1.0有:

/** 
* The time it took the server to make the result available for consumption. 
* 
* @param unit The unit of the duration. 
* @return The time it took for the server to have the result available in the provided time unit. 
*/ 
long resultAvailableAfter(TimeUnit unit); 

/** 
* The time it took the server to consume the result. 
* 
* @param unit The unit of the duration. 
* @return The time it took for the server to consume the result in the provided time unit. 
*/ 
long resultConsumedAfter(TimeUnit unit); 

它提供了兩個時間:

  1. 時間,直到第一個字節
  2. 全部執行時間包括服務器消耗數據

方法是localted上org.neo4j.driver.v1.summary.ResultSummary INTERF高手。

+0

中的statefield謝謝@arezoo你是對的,我錯過了它,因爲它只在最新的neo4j-java-driver 1.1.0中可用,而我正在使用1.0.5 –