How to Include Query Timings
- When running a query, you can request for statistics regarding the time it takes to perform the whole query as well as parts of it like the duration of document search and loading.
-
By default, this feature is disabled.
To enable it, addinclude timings()
to an RQL query or call.timings()
from your code. -
In this page:
Including Timings In a Query
Syntax
IDocumentQuery<T> timings(Reference<QueryTimings> timings);
The QueryTimings
object will be filled with the timings when the query returns.
QueryTimings |
||
---|---|---|
durationInMs | number |
Total duration |
timings | Record<string, QueryTimings> |
Dictionary with QueryTimings info per time part |
Example
Reference<QueryTimings> timingsRef = new Reference<>();
List<Product> resultsWithTimings = session.advanced().documentQuery(Product.class)
.timings(timingsRef)
.search("Name", "Syrup")
.toList();
Map<String, QueryTimings> timingsMap = timingsRef.value.getTimings();
from Products
where search(Name, 'Syrup')
include timings()
Viewing Timings
- Timings can be viewed using Studio's Query view.
- If
include Timings()
is added to an RQL query Studio will display an additional Timings tab with a graphical representation of the time it took to perform each query part.

Include timings results
In a sharded database, timings are provided per shard.
Read more about it here.