Loading TOC...

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

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.

Comments

The commenting feature on this page is enabled by a third party. Comments posted to this page are publicly visible.
  • Can you please explain the time format. In the above given example (PT0.04S) please describe about each letter.
    • You can see the full description under "Lexical Representation" on the <a href="https://www.w3.org/TR/xpath-functions/#dt-dayTimeDuration">xs:dayTimeDuration</a> page, but you can read this example as "a period of time of 0.04 seconds".