Entering content frame

 Cost Determination 

The Optimizer determines the costs of every possible search strategy.

When it determines the costs, the Optimizer only considers the expected number of I/O operations needed for the various search strategies. One I/O operation copies precisely one page. To make an estimate of the expected hit list, the Optimizer takes samples and uses the statistics provided by the database system.

The Optimizer does not consider costs incurred by resources such as CPU time or memory usage.

The cost of a search strategy is largely dependent upon the form of the search condition specified in the SQL statement. You must write your SQL statements so that they scan only those rows of the database tables that are actually needed. Results tables and temporary results tables must also be kept as small as possible.

You can use the EXPLAIN statement to examine the costs determined by the Optimizer for an SQL statement.

 

Leaving content frame