You are currently browsing legacy 4.1 version of documentation. Click here to switch to the newest 4.2 version.

We can help you with migration to the latest RavenDB

Contact Us Now
see on GitHub

Session: Querying: Debugging: How to include Query Timings

By default, detailed timings (duration of Lucene search, loading documents, transforming results) in queries are turned off, this is due to small overhead that calculation of such timings produces.

Syntax

IDocumentQuery<T> Timings(out QueryTimings timings);

Example

var resultWithTimings = session.Advanced.DocumentQuery<Product>()
    .Timings(out QueryTimings timings)
    .Search(x => x.Name, "Syrup")
    .ToList();

IDictionary<string, QueryTimings> timingsDictionary = timings.Timings;
var resultWithTimings = await session.Advanced.AsyncDocumentQuery<Product>()
    .Timings(out QueryTimings timings)
    .Search(x => x.Name, "Syrup")
    .ToListAsync();

IDictionary<string, QueryTimings> timingsDictionary = timings.Timings;
from Products 
where search(Name, 'Syrup')
include timings()


When you run the query with include timings() in Studio, extra tab appears.

Figure 1. Include timings graphical results

Include timings results