Start of Content Area

Background documentation EXPLAIN Statement Locate the document in its SAP Library structure

You can use the EXPLAIN statement to find out which search strategy the 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 which search strategy the Optimizer selected for this SQL statement. The PAGECOUNT column shows you the costs determined for the chosen search strategy.

Example

The EXPLAIN statement gets the following table:

TABLE NAME

COLUMN_
OR_INDEX

STRATEGY

PAGE COUNT

EXAMPLE

 

 

FIRSTKEY

 

 

RANGE CONDITION FOR KEY COLUMN

RESULT IS NOT COPIED, COSTVALUE IS

1250


97

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

For a complete syntax description for 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

 

End of Content Area