Query Processing Phases

There are two major phases in query processing: query optimization and query execution.

Query optimization is the process of choosing the fastest execution plan. In the optimization phase, the query processor chooses:

Query execution is the process of executing the plan chosen during query optimization. The query execution component also determines the techniques available to the query optimizer. For example, SQL Server implements a hash join algorithm and a merge join algorithm, both of which are available to the query optimizer.

The query optimizer is the brain of a relational database system, enabling it to work intelligently and efficiently.

A relational database with a sophisticated query optimizer is more likely to complete a query, especially a complex query, faster than a relational database with a simple query optimizer.