Entering content frame

 How the Optimizer Works 

SQL statements only specify the results that are required, and do not contain any information about how this data is found in the database.

The database system can often choose from multiple options for finding the data required by the SQL statement. The Optimizer has the task of determining the best search strategy for accessing the data.

The Optimizer works by running through the following steps:

...

       1.      The Optimizer is called when an SQL statement with a search condition is sent to the database.

       2.      The Optimizer converts the search condition into a standard format.

       3.      The Optimizer determines all search strategies that can be used to access the data specified in the SQL statement.

       4.      The Optimizer determines the cost of each of these search strategies and chooses the strategy that needs the fewest resources to process the SQL statement.

       5.      The database system uses this search strategy to execute the SQL statement.

 

Leaving content frame