Entering content frame

Background documentation EXPLAIN Statement Locate the document in the library structure

You can use the EXPLAIN statement to find out which search strategy Optimizer selected for an SQL statement.

Syntax

EXPLAIN <query_statement>

Example

EXPLAIN SELECT *

FROM example

WHERE firstkey > 30

The result of an EXPLAIN statement is a table. The STRATEGY column shows you the search strategy that Optimizer selected for this SQL statement. The PAGECOUNT column shows you the costs determined for the chosen search strategy.

Example

The EXPLAIN statement returns the following table:

TABLE NAME

COLUMN_
OR_INDEX

STRATEGY

PAGE COUNT

EXAMPLE

 

 

FIRSTKEY

 

 

RANGE CONDITION FOR KEY

RESULT IS NOT COPIED, COSTVALUE IS

1250


97

This means that the table examplehas 1250 pages; the I/O costs for executing this SQL statement are 97 pages.

For a complete syntax description of the EXPLAIN statement, see the Reference Manual, under EXPLAIN Statement (explain_statement).

See also:

·        EXPLAIN Statement for Joins

·        EXPLAIN Statement for Complicated SELECT Statements

·        EXPLAIN Statement for SELECT Statements with Subqueries

 

Leaving content frame