MarkLogic 10 Product Documentation
xdmp:elapsed-time

xdmp:elapsed-time() as xs:dayTimeDuration

Summary

Returns the elapsed time since the start of processing of this query. Gives the same information as the elapsed-time element of the xdmp:query-meters output, but has less overhead than calling xdmp:query-meters.

Usage Notes

Certain operations are run concurrently with the timing operations, and if those operations are not actually used in the query, they might not be included in the timings. This occurs for operations like xdmp:estimate, xdmp:exists, and lexicon calls (for example, cts:element-values). If you want to see the total timings that include calls that are not used, you can form some other expression with the results of the calls. For example, if you have an expression that calls xdmp:estimate in a let expression, you can add 0 to the output, which causes it to be included in the timings (something like xdmp:estimate($query) + 0).

Example

xquery version "1.0-ml";

fn:count(collection()),
xdmp:elapsed-time()

=> The count of the number of documents in the database followed by
   the elapsed-time of the query:

   153
   PT0.04S
Powered by MarkLogic Server | Terms of Use | Privacy Policy