xdmp:query-meters() as element()
Returns the current value of the resource meters for this query sequence.
The resource meters returned include:
- elapsed-time
- The time elapsed since the start of the processing of this query, in the form of a duration.
- requests
- The number of requests.
- list-cache-hits
- The number of successful list cache lookups. The list cache holds search termlists used to accelerate path expressions and text searches.
- list-cache-misses
- The number of unsuccessful list cache lookups. Each unsuccessful list cache lookup was followed by a disk access to load the search termlist into the cache.
- in-memory-list-hits
- The number of successful list lookups in in-memory stands.
- list-size
- The aggregate size in bytes read from disk by unsuccessful list cache lookups. Each unsuccessful list cache lookup is followed by a disk access to load the search term list into the cache.
- expanded-tree-cache-hits
- The number of successful expanded tree cache lookups. The expanded tree cache cache holds XML document data in the expanded representation used by the XQuery evaluator.
- expanded-tree-cache-misses
- The number of unsuccessful expanded tree cache lookups. Each unsuccessful expanded tree lookup was followed by a compressed tree cache lookup to load the expanded tree into the cache.
- compressed-tree-cache-hits
- The number of successful compressed tree cache lookups. The compressed tree cache holds XML document data in the compressed representation stored on disk.
- compressed-tree-cache-misses
- The number of unsuccessful compressed tree cache lookups. Each unsuccessful compressed tree cache lookup was followed by a disk access to load the compressed tree into the cache.
- in-memory-compressed-tree-hits
- The number of successful compressed tree lookups in in-memory stands.
- compressed-tree-size
- The aggregate size in bytes read from disk by unsuccessful compressed tree cache lookups. Each unsuccessful compressed tree cache lookup is followed by a disk access to load the compressed tree into the cache.
- value-cache-hits
- The number of successful value cache lookups. The value cache is a transient cache that exists only for the duration of one query. It holds typed values, and is used to accelerate the frequent conversion of nodes to typed values.
- value-cache-misses
- The number of unsuccessful value cache lookups. Each unsuccessful value cache lookup was followed by a conversion of an XML node to a typed value.
- regexp-cache-hits
- The number of successful regular expression cache lookups. The regular expression cache is a transient cache that exists only for the duration of one query. It holds compiled regular expressions, and is used to accelerate the frequent use of regular expressions during the evaluation of a query.
- regexp-cache-misses
- The number of unsuccessful regular expression cache lookups. Each unsuccessful regular expression cache lookup was followed by a compilation of a regular expression from source text.
- link-cache-hits
- The number of successful link cache lookups. The link cache is a transient cache that exists only for the duration of one query. It holds pointers to expanded trees, and is used to accelerate the frequent dereferencing of link nodes.
- link-cache-misses
- The number of unsuccessful link cache lookups. Each unsuccessful link cache lookup was followed by a search for the link target tree.
- filter-hits
- The number of successful search filter matches.
- filter-misses
- The number of unsuccessful search filter matches.
- fragments-added
- The number of XML fragments added to the database by an update.
- fragments-deleted
- The number of XML fragments deleted from the database by an update.
- fs-program-cache-hits
- The number of module cache hits from the entire program made from modules on the file system.
- fs-program-cache-misses
- The number of module cache misses from the entire program made from modules on the file system.
- db-program-cache-hits
- The number of module cache hits from the entire program made from modules in a database (may contain library modules from the special Modules directory).
- db-program-cache-misses
- The number of module cache misses from the entire program made from modules in a database (may contain library modules from the special Modules directory).
- env-program-cache-hits
- The number of module cache hits from the entire program made from ad hoc XSLT stylesheet nodes.
- env-program-cache-misses
- The number of module cache misses from the entire program made from ad hoc XSLT stylesheet nodes.
- fs-main-module-sequence-cache-hits
- The number of main module cache hits from main modules on the file system.
- fs-main-module-sequence-cache-misses
- The number of main module cache misses from main modules on the file system.
- db-main-module-sequence-cache-hits
- The number of main module cache hits from main modules in a database.
- db-main-module-sequence-cache-misses
- The number of main module cache misses from main modules in a database.
- fs-library-module-cache-hits
- The number of library module cache hits from library modules on the file system.
- fs-library-module-cache-misses
- The number of library module cache misses from library modules on the file system.
- db-library-module-cache-hits
- The number of library module cache hits from library modules from the modules database.
- db-library-module-cache-misses
- The number of library module cache misses from library modules from the modules database.
- read-locks
- The number of read locks.
- write-locks
- The number of write locks.
- compile-time
- The aggregate time in seconds spent compiling a module or a program.
- run-time
- The aggregate time in seconds spent evaluating/running a module or a program.
- lock-time
- The aggregate time in seconds forests spend waiting for transactional read and write locks. This time can exceed the run-time.
- contemporaneous-timestamp-time
- The time in seconds spent by queries waiting for the contemporaneous timestamp for which any transaction is known to have committed. When the multi-version concurrency control is set contemporaneous, queries can block waiting for the contemporaneous transactions to fully commit.
- indexing-time
- The indexing time of documents in seconds before they are inserted into the database.
- commit-time
- The aggregate commit phase time in seconds.
Some meters are broken down by fragment root and document URI:
- fragments
- A sequence of fragment elements, each containing:
- root
- The fragment root name.
- expanded-tree-cache-hits
- A count of successful expanded tree cache lookups for this fragment root.
- expanded-tree-cache-misses
- A count of unsuccessful expanded tree cache lookups for this fragment root.
- documents
- A sequence of document elements, each containing:
- uri
- The document URI.
- expanded-tree-cache-hits
- A count of successful expanded tree cache lookups for this document URI.
- expanded-tree-cache-misses
- A count of unsuccessful expanded tree cache lookups for this document URI.
There are also meters that measure the query activity per host. There is
a qm:hosts
element
with one
qm:host
child per host that
participates in the query. Each
qm:host
element
contains meters showing the round-trip-time
and
round-trip-count
for
communications between the evaluator host and the host referenced in the
xdmp:query-meters
output.
The qm:hosts
element
is empty for
a single-node cluster.
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
).
xdmp:query-meters() => <qm:query-meters xsi:schemaLocation="http://marklogic.com/xdmp/query-meters query-meters.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:qm="http://marklogic.com/xdmp/query-meters"> <qm:elapsed-time>PT0.22S</qm:elapsed-time> <qm:requests>1</qm:requests> <qm:list-cache-hits>0</qm:list-cache-hits> <qm:list-cache-misses>0</qm:list-cache-misses> <qm:list-size>0</qm:list-size> <qm:in-memory-list-hits>0</qm:in-memory-list-hits> <qm:expanded-tree-cache-hits>0 </qm:expanded-tree-cache-hits> <qm:expanded-tree-cache-misses>0 </qm:expanded-tree-cache-misses> <qm:compressed-tree-cache-hits>0 </qm:compressed-tree-cache-hits> <qm:compressed-tree-cache-misses>0 </qm:compressed-tree-cache-misses> <qm:in-memory-compressed-tree-hits>0 </qm:in-memory-compressed-tree-hits> <qm:compressed-tree-size>0</qm:compressed-tree-size> <qm:value-cache-hits>0</qm:value-cache-hits> <qm:value-cache-misses>0</qm:value-cache-misses> <qm:regexp-cache-hits>0</qm:regexp-cache-hits> <qm:regexp-cache-misses>0</qm:regexp-cache-misses> <qm:link-cache-hits>0</qm:link-cache-hits> <qm:link-cache-misses>0</qm:link-cache-misses> <qm:fragments-added>0</qm:fragments-added> <qm:fragments-deleted>0</qm:fragments-deleted> <qm:fs-program-cache-hits>1</qm:fs-program-cache-hits> <qm:fs-program-cache-misses>0</qm:fs-program-cache-misses> <qm:db-program-cache-hits>0</qm:db-program-cache-hits> <qm:db-program-cache-misses>0</qm:db-program-cache-misses> <qm:env-program-cache-hits>0</qm:env-program-cache-hits> <qm:env-program-cache-misses>0</qm:env-program-cache-misses> <qm:fs-main-module-sequence-cache-hits>0 </qm:fs-main-module-sequence-cache-hits> <qm:fs-main-module-sequence-cache-misses>0 </qm:fs-main-module-sequence-cache-misses> <qm:db-main-module-sequence-cache-hits>0 </qm:db-main-module-sequence-cache-hits> <qm:db-main-module-sequence-cache-misses>0 </qm:db-main-module-sequence-cache-misses> <qm:fs-library-module-cache-hits>0 </qm:fs-library-module-cache-hits> <qm:fs-library-module-cache-misses>0 </qm:fs-library-module-cache-misses> <qm:db-library-module-cache-hits>0 </qm:db-library-module-cache-hits> <qm:db-library-module-cache-misses>0 </qm:db-library-module-cache-misses> <qm:read-locks>0</qm:read-locks> <qm:write-locks>0</qm:write-locks> <qm:lock-time>0</qm:lock-time> <qm:contemporaneous-timestamp-time>0</qm:contemporaneous-timestamp-time> <qm:compile-time>0.000375</qm:compile-time> <qm:commit-time>0</qm:commit-time> <qm:run-time>0</qm:run-time> <qm:indexing-time>0</qm:indexing-time> <qm:fragments/> <qm:documents/> <qm:hosts/> </qm:query-meters>
xquery version "1.0-ml"; declare namespace qm="http://marklogic.com/xdmp/query-meters"; fn:count(collection()), xdmp:query-meters()/qm:elapsed-time => The count of the number of documents in the database followed by the elapsed-time element of the xdmp:query-trace XML output: 153 <qm:elapsed-time xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:qm="http://marklogic.com/xdmp/query-meters"> PT0.04S</qm:elapsed-time>