EXPLAIN Statement (explain_statement)
The EXPLAIN
statement (explain_statement
) describes the search strategy used internally by the database system for a QUERY
statement or SINGLE SELECT
statement (statements
for searching for certain rows in specific tables). This statement indicates in particular whether and in which form key columns or indexes are used for the search.
Syntax
<explain_statement> ::=
EXPLAIN [EXTERNAL] [(<result_table_name>)] <query_statement>
| EXPLAIN [EXTERNAL] [(<result_table_name>)] <single_select_statement>SQL Optimizer, Displaying Search Strategies Used for SQL Statements (EXPLAIN)
The EXPLAIN
statement can be used to check the effect that creating or deleting indexes has on the choice of search strategy for the specified SQL statement. It is also possible to estimate the time needed by the database system to process the specified SQL statement.
The specified QUERY
or SINGLE SELECT
statement is not executed while the EXPLAIN
statement is being executed.
The EXPLAIN
statement generates a result table. This result table may be named. If the optional name specification is missing, the result table is given the name SHOW
. The sequence in which the SELECT
is
processed is described by the order of the rows in the result table.
Column |
Description |
Data Type |
|---|---|---|
|
Schema name/owner |
CHAR(64) |
|
Table Name |
CHAR(64) |
|
Shows which key column, inverted column or index is used by the system for the strategy |
CHAR(64) |
|
Shows which search strategy or strategies the system uses and whether the system generates a result table. The system generates a result table when More information: SQL Optimizer, |
CHAR(40) |
|
Cost determination result for the selected search strategy This column shows which sizes are assumed for the tables or, in the case of certain strategies, for the indexes. These sizes affect which search strategy is selected by the system. To update the defined sizes, use the UPDATE STATISTICS statement or the relevant database tool function. You can query the defined sizes by selecting the system table OPTIMIZERINFORMATION. You can query the current sizes of tables or indexes by selecting the TABLESTORAGEDETAILS and INDEXSTORAGEDETAILS system tables. When you discover substantial differences between the values in If the system discovers during a search in a table that the values determined by the last The last row contains the estimated |
CHAR(10) |
The following information is only relevant for SAP MaxDB bridge functionality.
An EXPLAIN EXTERNAL
statement returns the following result set:
Column |
Description |
Data Type |
|---|---|---|
|
Number n indicates that the SQL statement is the n-th entry in the external SQL statement information. This number corresponds to the number n found in |
FIXED(10) |
|
SQL statement that will be executed at the data source |
CLOB UNICODE |
|
Result of the |
CLOB UNICODE |
The EXECUTIONPLAN
content is formatted as described in Database Manager CLI, sql_execute.
Database Administration, SQL Optimizer
Database Administration in CCMS,
Database Studio, Displaying Search Strategies Used for SQL Statements (EXPLAIN)