Get Query Statistics
Query statistics can provide important information about a query like duration, total number of results, staleness information, etc. To access statistics use the Statistics
method.
Syntax
IRavenQueryable<TResult> Statistics(out QueryStatistics stats);
Parameters | ||
---|---|---|
stats | QueryStatistics |
Statistics for query. |
Example
List<Employee> employees = session.Query<Employee>()
.Where(x => x.FirstName == "Robert")
.Statistics(out QueryStatistics stats)
.ToList();
int totalResults = stats.TotalResults;
long durationInMilliseconds = stats.DurationInMs;