2

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" );

しかし、 StatementResultまたはによって返されるResultSummaryのどこにも見つかりませんでしたStatementResult.consume(query)

からデータベースヒットにアクセスできProfiledPlanましResultSummaryたが、時間に関する情報はありません。

neo4j Java ドライバーを使用して Cypher クエリの実行時間にアクセスする方法はありますか?

4

1 に答える 1

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. サーバーからのデータの消費を含む完全な実行時間

メソッドはorg.neo4j.driver.v1.summary.ResultSummaryインターフェイスでローカライズされます。

于 2017-01-02T11:04:32.500 に答える