You are currently browsing legacy 5.0 version of documentation. Click here to switch to the newest 5.1 version.
Session: Querying: How to 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
IRavenQueryable<TResult> Statistics(out QueryStatistics stats);
||Statistics for query.|
List<Employee> employees = session.Query<Employee>() .Where(x => x.FirstName == "Robert") .Statistics(out QueryStatistics stats) .ToList(); int totalResults = stats.TotalResults; long durationInMilliseconds = stats.DurationInMs;