Page 204 - DCAP402_DCAO204_DATABASE MANAGEMENT SYSTEM_MANAGING DATABASE
P. 204
Unit 12: Query Processing and Optimization
Notes
12.10 Summary
12.11 Keywords
12.12 Self Assessment
12.13 Review Questions
12.14 Further Readings
Objectives
After studying this unit, you will be able to:
Describe query processing
Realise selection operation and join operation
State the creation of query evaluation plan
Explain the choice of evaluation plan
Introduction
The Query Language – SQL is one of the main reasons of success of RDBMS. A user just needs to
specify the query in SQL that is close to the English language and does not need to say how such
query is to be evaluated. However, a query needs to be evaluated efficiently by the DBMS. But
how is a query-evaluated efficiently? This unit attempts to answer this question. The unit covers
the basic principles of query evaluation, the cost of query evaluation, the evaluation of join
queries, etc. in detail. It also provides information about query evaluation plans and the role of
storage in query evaluation and optimisation.
12.1 Query Processing: An Overview
Figure 12.1 shows the processing of an query.
In the first step Scanning, Parsing, and Validating is done to translate the query into its internal
form. This is then further translated into relational algebra (an intermediate query form). Parser
checks syntax and verifies relations. The query then is optimised with a query plan, which then
is compiled into a code that can be executed by the database runtime processor.
You can define query evaluation as the query-execution engine taking a query-evaluation plan,
executing that plan, and returning the answers to the query. The query processing involves the
study of the following concepts:
1. How to measure query costs?
2. Algorithms for evaluating relational algebraic operations.
3. How to evaluate a complete expression using algorithms on individual operations?
LOVELY PROFESSIONAL UNIVERSITY 197