Session: Querying: How to get query statistics?
Query statistics can provide important information about query e.g. duration, total number of results, staleness information, etc. To access statistics use Statistics
method.
Syntax
IRavenQueryable<TResult> Statistics(out RavenQueryStatistics stats);
Example
RavenQueryStatistics stats;
List<Employee> employees = session.Query<Employee>()
.Where(x => x.FirstName == "Robert")
.Statistics(out stats)
.ToList();
int totalResults = stats.TotalResults;
long durationMilliseconds = stats.DurationMilliseconds;