繁体   English   中英

使用 Neo4j java 驱动程序的 Cypher 查询执行时间

[英]Cypher query execution time with Neo4j java driver

我正在尝试使用 java 驱动程序找出我的 Cypher 查询的执行时间。

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)返回。

我可以从ResultSummary ProfiledPlan访问数据库命中,但没有关于时间的信息。

有什么办法可以使用neo4j java驱动程序访问Cypher查询执行时间吗?

由于 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. 完整的执行时间,包括从服务器消耗数据

方法位于org.neo4j.driver.v1.summary.ResultSummary接口上。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM