Loading TOC...

MarkLogic 12 EA 2 Product Documentation
xdmp:sql-plan

xdmp:sql-plan(
   $sql as xs:string,
   [$options as xs:string*]
) as element()

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.
"xml"
Outputs an XML format query plan. This is the default.
"json"
Outputs a JSON format query plan. The default is "xml".

Required Privileges

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

Example

xdmp:sql-plan("select  customername, customersince
from customers
where year(customersince)  >  2000
and year(customersince)  <  2013")

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