SQL statements should be written in such a way that the following aims for the processing of an SQL statement are achieved when a search strategy is selected:
· Search only those rows that it is necessary to search
· Restrict results tables and temporary results tables to the smallest possible size
The search strategy that is selected is largely dependent upon the form of the search condition specified in the SQL statement. The search strategy is also selected so that the costs for the processing of the SQL statement are minimized.
For more detailed information about the selection of the search strategy, see the following sections:
· Search Conditions for Key Columns
· Search Conditions for Inverted Columns
· Search Conditions for UPDATE Statements
· Search Conditions Linked with OR
· Postponement of the Search to the FETCH Time
· Join
· List of All Search Strategies
You can display the search strategy used for an SQL statement with the help of the EXPLAIN statement.