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(Reference<RavenQueryStatistics> stats);

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


Reference<RavenQueryStatistics> statsRef = new Reference<>();
QEmployee e = QEmployee.employee;
List<Employee> employees = session

int totalResults = statsRef.value.getTotalResults();
long durationMiliseconds = statsRef.value.getDurationMiliseconds();