MarkLogic 9 Product Documentation
xdmp.sqlPlan

xdmp.sqlPlan(
   sql as String,
   [options as String[]]
) as ObjectNode

Summary

Returns a node representing the query plan of the given SQL SELECT query. Raises an error if the SQL query is not a SELECT query.

Parameters
sql The SQL query to be executed.
options Options as a sequence 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.

Required Privileges

http://marklogic.com/xdmp/privileges/xdmp-sql

Example

xdmp.sqlPlan("select  customername, customersince\n\
from customers\n\
where year(customersince)  >  2000\n\
and year(customersince)  <  2013")
Powered by MarkLogic Server | Terms of Use | Privacy Policy