Professional Documents
Culture Documents
Amravati
Course Name: Database Management Systems (ITU
422)
Topic Name : Evaluation of Expressions
Course Co-Ordinator : S.R. Wankhade
21007008 21007009
21007064 21007016
03 Approaches of Query
Evaluation
04 Comparison
01
What is Query
Evaluation?
What is Query
Evaluation ?
It is nothing but a program for an
abstract machine inside the DBMS. It
is produced by the query optimizer. At
times this can also be termed as access
plan because DBMS decide how to
access the rows. Query evaluation
plans are very much similar to
relational algebra expressions in most
of the systems.
02
Query
Evaluation Plans
Creation of Query Evaluation Plan
Generation of query-evaluation plans for an expression involves
several steps:
1 . Materialization
Demand-driven Pipeline
2 . Pipelining
Producer-driven Pipeline
1. MATERIALIZATION
Use appropriate algorithm for evaluation. Begin by evaluating lowest level operation.
2
Store the result of the operation in the temporary relations. (Result works as an input for
3 every next level up in the tree.)
Use these temporary relations for evaluating the next-level operation in the operator
4 tree.
5 Repeat these steps until all operators at the root of tree will be evaluated
MATERIALIZATION
Lets understand by example how will query evaluate by materialization.
Student Result
Roll no. Name Roll no. Marks
1 Akhil 1 45
2 Jon 2 85 Query is: ( (Student ⋈ σ Marks > 90 (Result))
3 Rohan 3 96 Output
4 Suresh 4 92
Rohan 3 Rohan 96 3 96
Suresh 4 Suresh 92 4 92
MATERIALIZATION
𝜋 Name
It is called Materialization evalution since,
the result to each intermediate operation are
⋈ created (materialized) and then are then are
used to evaluate of the rest level operation.
σ Mark > 90 Student
2 . Procedure Driven
(Push Approach)
Demand Procedure
Start with input
Start with input relations.
relations.
Driven
Producers push relevant
Apply each operation
data to subsequent
and produce data only
operations or
when demanded.
Driven
consumers.
Pass
Consumers
demanded receive
data
pushed
directly
datatoand
the perform
next
computations.
operation.
2 Nilesh 16 2 Science B2
3 Suresh 14 3 Eng A2
ID Name Age ID Subject Grade
1 Akash 15 1 Maths A+
1 Akash 15 2 Science B2
1 Akash 15 3 Eng A2
2 Nilesh 16 1 Maths A+
2 Nilesh 16 2 Science B2
2 Nilesh 16 3 Eng A2
3 Suresh 14 1 Maths A+
3 Suresh 14 2 Science B2
3 Suresh 14 3 Eng A2
ID Name Age ID Subject Grade
1 Akash 15 1 Maths A+
1 Akash 15 2 Science B2
1 Akash 15 3 Eng A2
2 Nilesh 16 1 Maths A+
2 Nilesh 16 2 Science B2
2 Nilesh 16 3 Eng A2
3 Suresh 14 1 Maths A+
3 Suresh 14 2 Science B2
3 Suresh 14 3 Eng A2
ID Name Age ID Subject Grade
1 Akash 15 1 Maths A+
2 Nilesh 16 2 Science B2
3 Suresh 14 3 Eng A2
Name Subject Grade
Akash Maths A+
Nilesh Science B2
Suresh Eng A2
04 Compare
MATERIALIZA
TION VS
PIPELINING
Traditional
Modern Approach
Approach
Uses temporary
Don't Materialization
relations
use temporary
results
the results
to store
relations the
to store Pipelining
Less Efficient
More Efficient
No highermemory
Requires requirement of secondary
buffers at a high rate for
memory
generating outputs
No Trashing
Poor performance in trashing
Costlier
Less CostOperation
Thanks!
Any questions?