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, add
include timings()to an RQL query or call
.timings()from your code.
In this page:
Including Timings In a Query
IDocumentQuery<T> timings(Reference<QueryTimings> timings);
QueryTimings object will be filled with the timings when the query returns.
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()
- Timings can be viewed using Studio's Query view.
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.