see on GitHub

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.


IRavenQueryable<TResult> Statistics(out RavenQueryStatistics stats);

stats RavenQueryStatistics Statistics for query.
Return Value
RavenQueryStatistics Statistics for query.


RavenQueryStatistics stats;
List<Employee> employees = session.Query<Employee>()
	.Where(x => x.FirstName == "Robert")
	.Statistics(out stats)

int totalResults = stats.TotalResults;
long durationMilliseconds = stats.DurationMilliseconds;