0
特定のクエリの実行時にクエリ統計情報を出力しようとしています。特に、私はミリ秒単位でサーバー上の実行時間に興味があります。以下は参照RavenDB Query統計サーバの実行時間(ミリ秒単位)
void Main()
{
var documentStore = DocumentStoreHolder.Store;
Load_Stats(documentStore);
}
// Define other methods and classes here
public static void Load_Stats(IDocumentStore documentStore)
{
using (var session = documentStore.OpenSession())
{
RavenQueryStatistics stats;
IRavenQueryable<Order> recentOrdersQuery = from order in session.Query<Order>().Statistics(out stats) where order.Company=="companies/1" select order;
List<Order> recentOrders = recentOrdersQuery.Take(3).ToList();
Console.WriteLine("Index used was: " + stats.IndexName);
Console.WriteLine($"Other stats : 1. Execution time on the server : {stats.DurationMilliseconds} 2.Total number of results {stats.TotalResults} 3. The last document ETag {stats.ResultEtag} 4. The timestamp of last document indexed by the index {stats.IndexTimestamp}");
}
ためしかし、私は-1として、ミリ秒単位でサーバー上のクエリを実行するのにかかる時間を取得このクエリの繰り返し実行時に私のコードです。私はなぜそれが起こっているのか理解していない。結果を長い変数に代入するか、そのように結果を出力することができるか(stats.DurationMilliseconds)。 TIA
ありがとうOren!以前のクエリで使用していなかった別の述語を試したところ、有効な結果を得ることができました。テストのためにキャッシュを無効にするためにクライアント側のオプションを探索します。 –