You can use the EXPLAIN statement to find out which search strategy the 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 which search strategy the Optimizer selected for this SQL statement. The PAGECOUNT column shows you the costs determined for the chosen search strategy.
The EXPLAIN statement gets the following table:
TABLE NAME |
COLUMN_ |
STRATEGY |
PAGE COUNT |
EXAMPLE
|
FIRSTKEY
|
RANGE CONDITION FOR KEY COLUMN RESULT IS NOT COPIED, COSTVALUE IS |
1250
|
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 Complicated SELECT Statements
· EXPLAIN Statement for SELECT Statements with Subqueries