Время выполнения запроса Cypher с помощью драйвера Neo4j Java
Я пытаюсь выяснить время выполнения моего запроса Cypher с драйвером 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" );
Но я не смог найти его нигде в StatementResult или в ResultSummary, который возвращается StatementResult.consume(query)
,
Я мог получить доступ к дб хиты из ProfiledPlan
в ResultSummary
но нет информации о времени.
Есть ли способ получить доступ к времени выполнения запроса Cypher с помощью драйвера neo4j java?
1 ответ
Решение
Начиная с версии 1.1.0 драйвера Java Neo4j:
/**
* 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 );
Он предоставляет вам оба раза:
- Время до первого байта
- Полное время выполнения, включая потребление данных с сервера
Методы локализованы на org.neo4j.driver.v1.summary.ResultSummary
интерфейс.