MarkLogic Server 11.0 Product Documentation
op:explain

op:explain(
   $plan as map:map,
   [$format as xs:string],
   [$options as xs:sring*]
) as map:map

Summary

This method returns a representation of the builtin execution plan.

Parameters
$plan The Optic Plan. You can either use the XQuery => chaining operator or specify the variable that captures the return value from the previous operation.
$format The format of the returned plan, expressed as a lower-case string. This can be either xml (default) or json.
$options Options as an array of string values. Available options are:
  • "optimize=N"

    Sets the optimization level to use. Levels of 0 (off), 1, and 2 are recognized. The default is 1.

  • "seed=N"

    Sets the seed to use. The default will generate a random seed. Setting it to 0 will behave the same as the default case. The default is 0.

Example

xquery version "1.0-ml";

import module namespace op="http://marklogic.com/optic"
     at "/MarkLogic/optic.xqy";

op:from-view("main", "employees")
   => op:select(("EmployeeID", "FirstName", "LastName"))
   => op:order-by("EmployeeID")
   => op:explain()
  

Example

xquery version "1.0-ml";

import module namespace op="http://marklogic.com/optic"
     at "/MarkLogic/optic.xqy";

op:from-view("main", "employees")
   => op:select(("EmployeeID", "FirstName", "LastName"))
   => op:order-by("EmployeeID")
   => op:explain("json",("seed=0", "optimize=1"))
  
Powered by MarkLogic Server | Terms of Use | Privacy Policy