Chapter 1 Query Processing and Optimization
Chapter 1 Query Processing and Optimization
Sirage Z.
Department of Computer Science
Debre Berhan University
2022
Query Processing
Query is a request for data or information from a database
table.
QP Is find information in one or more databases and deliver it
to the user quickly and efficiently.
Databases containing more complex and diverse types of data
demand new query processing and optimization techniques.
Query Processing can be divided into four main phases:
• Decomposition:
• Optimization
• Code generation, and
• Execution
05/26/2025 Query Processing and Optimization 2
Query Processing Steps
Where c1€{a1,a2…an}
(R c1S)=(S R)
c1
c1(R c S) =(c1(R)) S
c )
b.If the predicate is in the form c1 ʌ c2 and c1 involves only attributes of R
and c2 involves only attributes of S, then the Selection and Theta Join
operations commute
8. Commutativity of the Set Operations: UNION and INTERSECTION but not SET
R ∩ S=S ∩ R and R ∪ S=S ∪ R
DIFFERENCE:
after this
modification will
(PProjID=WProjID
)
be:
X
(WEmpID=EEmpID)
(PName=’Ring
Road’)
PROJECT
X
EMPLOYEE
( WEmpID=EEmpID
)
( PProjID=WProjID
)
(DoB<Jan1 1965
)
EMPLOY EE
X
(PName=’Ring
Road’) WORKS_ON
PROJECT
( WEmpID=EEmpID )
(DoB<Jan 1 1965)
( PProjID=WProjID )
EMPLOY EE
(PName=’Ring
‘)
Road
WORKS_ON
PROJECT
( WEmpID=EEmpID
)
<WEmpID>
( PProjID=WProjID
)
<FName,LName,EEmpID>
<PProjID> EMPLOYEE
(PName=’Ring
Road’)
PROJECT