Skip to main content
Outputs the execution plan of a given SQL statement.
For the visual explain plan utility in GAdmin, see the Explain feature under SQL Tool.
EXPLAIN Syntax
Each supporting API endpoint call that is made in servicing the request is listed as an execution plan step in the output, along with any input or output tables associated with the call and the prior plan execution steps on which a given execution step depends. The following options can be specified:
  • PHYSICAL - (default) outputs the physical execution plan with the following endpoint-level details per step:
    • ID - execution step number
    • ENDPOINT - name of native API endpoint called
    • INPUT_TABLES - input tables used by the endpoint (if any)
    • OUTPUT_TABLE - output table created by the endpoint (if any)
    • DEPENDENCIES - list of prior execution steps upon which this step depends
  • ANALYZE - same as PHYSICAL, including additional run-time details:
    • RUN_TIME - execution time of each endpoint call
    • RESULT_ROWS - number of records produced in the endpoint call
  • VERBOSE - same as PHYSICAL, including endpoint parameter details:
    • COLUMNS - columns passed to the endpoint call
    • EXPRESSIONS - expressions passed to the endpoint call
    • OPTIONS - option keys & values passed to the endpoint call
    • LAST_USE_TABLES - list of tables that will not be used by any following execution step
    • ADDITIONAL_INFO - other parameters passed to the endpoint call
  • VERBOSE ANALYZE - same as VERBOSE & ANALYZE together, including the execution plan for any joins contained within the query
  • FORMAT JSON - outputs the result in JSON format
  • FORMAT TABLE - (default) outputs the result in tabular format
For PHYSICAL & VERBOSE modes, the /* KI_HINT_RECURSIVE_EXPLAIN */ hint can be used to show the plan recursively through any materialized views involved in the query.
Specifying ANALYZE will cause the statement to be executed in order to collect run-time statistics on the endpoint calls made.
For example, to output the execution plan for a query that aggregates the number of taxi rides between boroughs:
EXPLAIN Example
The execution plan is listed in table format, as follows:
EXPLAIN Output
If there is an error processing a query, the error can be returned in the JSON-formatted execution plan:
EXPLAIN with Detail Example
The execution plan is listed in JSON format with the query error, as follows:
with Detail Output