Explain Plan Command

The explain command displays the execution plan for a statement without actually executing the statement; it parses and optimizes the SQL, then presents its execution plan.

You can use this to tune a query for improved performance.

Syntax

explain Statement

Statement

An SQL statement.

Usage

SQL Data Definition Language (DDL) statement have no known cost, and thus do not require optimization. Because of this, the explain command does not work with DDL statements; attempting to explain a DDL statement such as CREATE TABLE will generate a syntax error.

For more information about using the explain command, including a number of annotated examples, see Explain Plan.

Examples

splice> explain select * from t t1 where t1.i < (select max(i) from t t1);

The Explain Plan topic contains a number of examples that are described in detail.