Cypher使用Neo4j java驱动程序查询执行时间 [英] Cypher query execution time with Neo4j java driver

查看:847
本文介绍了Cypher使用Neo4j java驱动程序查询执行时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图用java驱动程序找出我的Cypher查询的执行时间。

I am trying to find out execution time of my Cypher query with java driver.

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返回。消耗(查询)

我可以在 ResultSummary 中从 ProfiledPlan 访问db命中但是没有关于时间的信息。

I could access db hits from ProfiledPlan in ResultSummary but there is no information about time.

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

Is there any way I can access Cypher query execution time using neo4j java driver?

推荐答案

由于Neo4j Java驱动程序版本1.1.0有:

Since Neo4j Java driver version 1.1.0 there is:

/**
 * 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 界面上进行了本地化。

Methods are localted on org.neo4j.driver.v1.summary.ResultSummary interface.

这篇关于Cypher使用Neo4j java驱动程序查询执行时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆