Oracle Database - Query optimizer

About

A SQL statement can be executed in many different ways, such as full table scans, index scans, nested loops, and hash joins. The query optimizer determines the most efficient way to execute a SQL statement after considering many factors related to the objects referenced and the conditions specified in the query. This determination is an important step in the processing of any SQL statement and can greatly affect execution time.

The optimizer might not make the same decisions from one version of Oracle Database to the next. In recent versions, the optimizer might make different decisions, because better information is available.

The output from the optimizer is an Oracle Database - Execution/Query Plan that describes an optimum method of execution. The plans shows the combination of the steps Oracle Database uses to execute a SQL statement. Each step either retrieves rows of data physically from the database or prepares them in some way for the user issuing the statement.

In general the databases are going to correctly optimize queries. Queries are rarely incorrectly optimized.

Articles Related

Understanding the optimizer

The query optimizer performs the following steps:

  • 1- The query transformer transform the original query (if it is advantageous)
  • 2- The optimizer generates a set of potential plans for the SQL statement based on available access paths and hints.
  • 3- The optimizer estimates the cost of each plan based on statistics in the data dictionary for the data distribution and storage characteristics of the tables, indexes, and partitions accessed by the statement.
  • 4- The optimizer compares the costs of the plans and chooses the one with the lowest cost.

Influence the optimizer's choices

You can influence the optimizer's choices by

Reference

  • Bookmark "Oracle Database - Query optimizer" at del.icio.us
  • Bookmark "Oracle Database - Query optimizer" at Digg
  • Bookmark "Oracle Database - Query optimizer" at Ask
  • Bookmark "Oracle Database - Query optimizer" at Google
  • Bookmark "Oracle Database - Query optimizer" at StumbleUpon
  • Bookmark "Oracle Database - Query optimizer" at Technorati
  • Bookmark "Oracle Database - Query optimizer" at Live Bookmarks
  • Bookmark "Oracle Database - Query optimizer" at Yahoo! Myweb
  • Bookmark "Oracle Database - Query optimizer" at Facebook
  • Bookmark "Oracle Database - Query optimizer" at Yahoo! Bookmarks
  • Bookmark "Oracle Database - Query optimizer" at Twitter
  • Bookmark "Oracle Database - Query optimizer" at myAOL
 
database/oracle/optimizer.txt · Last modified: 2010/11/12 09:57 by gerardnico