Query Processing & Query Optimization

Query Processing

  1. Find one or more plans for carrying out the processing
  2. Estimate the costs, and select the most efficient plan.
  3. Carry out the plan.
We look at selects, projects, and joins.

Processing Selection Queries:

Conjunctive & Disjunctive Queries: Projections:

Join Operations Here there are several strategies that can be employed, and the choice of strategy can have a big impact on the efficiency of the plan.  (Pay attention to the notation here:  Bc and Rc refer to  the number of blocks and records in the c (customer) table, respectively, for example.  We look at a simple example:
 

SELECT * FROM Customer c, Rental r
WHERE c.accountId = r.accountId
 


Query Optimization:   We return to the task of the Query Optimizer.

  1. Enumerate the query plans.
  2. Estimate the costs of the plans.
  3. Choose the best plan.
  4. Execute the best plan.

We examine an example, as presented in the Text.