View Query Metrics or Plan

  • how-to
    +
    The workbench for Enterprise Analytics provides metrics for each query you run, and a detailed query plan in both text and graphical format.

    Prerequisites

    To use the Enterprise Analytics UI, you need the Enterprise Analytics Access role along with specific privileges.

    Review Query Metrics

    When a query finishes, metrics for that query appear on the workbench between the query editor and the query results panes. The metrics are:

    • elapsed — Shows the overall query time.

    • execution — Shows the query execution time.

    • compilation — Shows the query compilation time between execution and waiting in queue.

    • waiting in queue — Shows the query wait time in the queue before beginning execution.

    • docs scanned — Shows the number of scanned JSON documents.

    • docs returned — Shows the number of returned JSON documents.

    • size — Shows the size of the query results, in bytes.

    Copy Query Metrics

    After a query completes, a icon appears next to the Query Results heading. Hover over the icon to preview the full metrics response as formatted JSON, or click it to copy the metrics JSON to your clipboard.

    View the Query Plan and Plan Text

    When you execute a query from the Workbench, the plan is automatically returned as part of the response.

    You can view the query plan in the query results pane: select the Plan tab.

    The Plan tab presents the query execution plan in a graphical format.

    The Plan Text tab presents the query execution plan in JSON format.

    Enterprise Analytics uses rule-based optimization to query your collections until you run an ANALYZE COLLECTION statement on each collection involved in a query. The ANALYZE statement samples the data in a collection so that cost-based optimization (CBO) can be applied. As the data in a collection changes, you can run ANALYZE COLLECTION periodically to update the information used for CBO.