You can use the EXPLAIN statement to find out which search strategy Optimizer selected for an SQL statement.
EXPLAIN <query_statement>
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.
The EXPLAIN statement returns the following table:
TABLE NAME |
COLUMN_ |
STRATEGY |
PAGE COUNT |
EXAMPLE
|
FIRSTKEY
|
RESULT IS NOT COPIED, COSTVALUE IS |
1250
|
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 Complicated SELECT Statements
· EXPLAIN Statement for SELECT Statements with Subqueries