SlideShare a Scribd company logo
1. Query Processing
2. Translating SQL queries into RA
3. Evaluation Plan

4. Query Execution
5. Query Optimization
6. Translation Rules
7. Cost Estimations
1. Query Processing
1. Query Processing
▪ Aim of query processing
- to find information in one or more databases,
- and deliver it to the user quickly and efficiently.
- to choose the most cost effective.
▪ Translation of queries
- into expressions that can be used at physical level of file system.
- Includes query optimization and query evaluation.
1. Query Processing
1. Query Processing
▪ Typical steps when processing a high-level query (e.g. SQL query)
Query tree
internal representation
of the query
Execution strategy
how to retrieve
results of query
2. Translating SQL queries into RA
2. Translating SQL queries into RA
▪ Translate query into its internal form.
- This is then translated into Relational Algebra(RA).
- The parser checks syntax, verifies relations.
▪ A RA expression may have many equivalent expressions.
▪ Example
Σbalance<2500(πbalance(account))
Is equivalent to
Πbalance(σbalance<2500(account))

Each relational algebra operation can be evaluated using one of
several different algorithms. Correspondingly, a relational-algebra
expression can be evaluated in many ways.
3. Evaluation Plan
3. Evaluation Plan
▪ Annotated expression specifying detailed evaluation strategy.
▪ Example
Use an index on balance to find accounts with balance < 2500,
Or perform complete relation scan and discard accounts with balance ≥ 2500.
Initial canonical query tree
Book (access#, title)
Member (ticket#, name)
Loan(loanedbook,loanedto)

Select member.name
rom book, loan, member
where book.title = "dracula"
and member.ticket# = loan.loanedto
and loan.loanedbook = book.access#
4. Query Execution
4. Query Execution
For each operation (join, select, project, aggregation …)
- Typical algorithms (e.g. Binary search for simple selection)
- Specific or not to storage structure and access paths
Book (access#, title)
Member (ticket#, name)
Loan(loanedbook,loanedto)

Select member.name
From book, loan, member
where book.title = "dracula"
and member.ticket# = loan.loanedto
and loan.loanedbook = book.access#
4. Query Execution
4. Query Execution

More Related Content

PPTX
Query processing and optimization (updated)
PPTX
Query optimization
PPTX
Query optimization
PPTX
Query optimization
PPTX
PPTX
Theory of dependencies in relational database
PPT
DBMS Canonical cover
PPT
Operating system services 9
Query processing and optimization (updated)
Query optimization
Query optimization
Query optimization
Theory of dependencies in relational database
DBMS Canonical cover
Operating system services 9

Similar to 1 query processing (20)

PPTX
Query Processing in Database mgmt system
PPTX
Query processing and Query Optimization
PPTX
Query processing and Query Optimization
PPTX
Ch-2-Query-Process.pptx advanced database
PPTX
700442110-advanced database Ch-2-Query-Process.pptx
PPT
Query optimization and processing for advanced database systems
PPTX
LECTURE_06_DATABASE PROCESSING & OPTIMAZATION.pptx
PPT
ch02-240507064009-ac337bf1 .ppt
PPT
QPOfutyfurfugfuyttruft7rfu65rfuyt PPT - Copy.ppt
PDF
Chapter 2.pdf WND FWKJFW KSD;KFLWHFB ASNK
PPTX
DB LECTURE 5 QUERY PROCESSING.pptx
PPT
9-Query Processing-05-06-2023.PPT
PPTX
Mc seminar
PDF
itm661-lecture0VBBBBBBBBBBBBBBM3-part2-2015.pdf
PPTX
Query processing
PPTX
Query processing and optimization on dbms
PPT
Query processing-and-optimization
PPTX
Chapter 4 - Query Processing and Optimization.pptx
PPTX
Advanced Database System Chapter Two Query processing and Optimization.pptx
PDF
CH5_Query Processing and Optimization.pdf
Query Processing in Database mgmt system
Query processing and Query Optimization
Query processing and Query Optimization
Ch-2-Query-Process.pptx advanced database
700442110-advanced database Ch-2-Query-Process.pptx
Query optimization and processing for advanced database systems
LECTURE_06_DATABASE PROCESSING & OPTIMAZATION.pptx
ch02-240507064009-ac337bf1 .ppt
QPOfutyfurfugfuyttruft7rfu65rfuyt PPT - Copy.ppt
Chapter 2.pdf WND FWKJFW KSD;KFLWHFB ASNK
DB LECTURE 5 QUERY PROCESSING.pptx
9-Query Processing-05-06-2023.PPT
Mc seminar
itm661-lecture0VBBBBBBBBBBBBBBM3-part2-2015.pdf
Query processing
Query processing and optimization on dbms
Query processing-and-optimization
Chapter 4 - Query Processing and Optimization.pptx
Advanced Database System Chapter Two Query processing and Optimization.pptx
CH5_Query Processing and Optimization.pdf
Ad

More from Mr Patrick NIYISHAKA (20)

PPTX
PPTX
2 ddb architecture
PPTX
2 countermeasures
PPTX
2 countermeasures
PPTX
PPTX
1 db security
PPTX
PPTX
PPTX
2 con control
PPTX
PPTX
1 basic concepts
PPTX
PPTX
3 transaction
PPTX
PPTX
1 query processing
PPTX
2 optimization
PPTX
PPTX
2 ddb architecture
2 countermeasures
2 countermeasures
1 db security
2 con control
1 basic concepts
3 transaction
1 query processing
2 optimization
Ad

Recently uploaded (20)

PPTX
Microbial diseases, their pathogenesis and prophylaxis
PDF
Microbial disease of the cardiovascular and lymphatic systems
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PDF
O7-L3 Supply Chain Operations - ICLT Program
PPTX
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PPTX
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PDF
Classroom Observation Tools for Teachers
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PDF
Weekly quiz Compilation Jan -July 25.pdf
DOC
Soft-furnishing-By-Architect-A.F.M.Mohiuddin-Akhand.doc
PPTX
Pharma ospi slides which help in ospi learning
PDF
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PDF
Supply Chain Operations Speaking Notes -ICLT Program
Microbial diseases, their pathogenesis and prophylaxis
Microbial disease of the cardiovascular and lymphatic systems
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
2.FourierTransform-ShortQuestionswithAnswers.pdf
O7-L3 Supply Chain Operations - ICLT Program
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
Pharmacology of Heart Failure /Pharmacotherapy of CHF
Classroom Observation Tools for Teachers
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
Weekly quiz Compilation Jan -July 25.pdf
Soft-furnishing-By-Architect-A.F.M.Mohiuddin-Akhand.doc
Pharma ospi slides which help in ospi learning
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
Final Presentation General Medicine 03-08-2024.pptx
FourierSeries-QuestionsWithAnswers(Part-A).pdf
Supply Chain Operations Speaking Notes -ICLT Program

1 query processing

  • 1. 1. Query Processing 2. Translating SQL queries into RA 3. Evaluation Plan 4. Query Execution 5. Query Optimization 6. Translation Rules 7. Cost Estimations
  • 2. 1. Query Processing 1. Query Processing ▪ Aim of query processing - to find information in one or more databases, - and deliver it to the user quickly and efficiently. - to choose the most cost effective. ▪ Translation of queries - into expressions that can be used at physical level of file system. - Includes query optimization and query evaluation.
  • 3. 1. Query Processing 1. Query Processing ▪ Typical steps when processing a high-level query (e.g. SQL query) Query tree internal representation of the query Execution strategy how to retrieve results of query
  • 4. 2. Translating SQL queries into RA 2. Translating SQL queries into RA ▪ Translate query into its internal form. - This is then translated into Relational Algebra(RA). - The parser checks syntax, verifies relations. ▪ A RA expression may have many equivalent expressions. ▪ Example Σbalance<2500(πbalance(account)) Is equivalent to Πbalance(σbalance<2500(account)) Each relational algebra operation can be evaluated using one of several different algorithms. Correspondingly, a relational-algebra expression can be evaluated in many ways.
  • 5. 3. Evaluation Plan 3. Evaluation Plan ▪ Annotated expression specifying detailed evaluation strategy. ▪ Example Use an index on balance to find accounts with balance < 2500, Or perform complete relation scan and discard accounts with balance ≥ 2500. Initial canonical query tree Book (access#, title) Member (ticket#, name) Loan(loanedbook,loanedto) Select member.name rom book, loan, member where book.title = "dracula" and member.ticket# = loan.loanedto and loan.loanedbook = book.access#
  • 6. 4. Query Execution 4. Query Execution For each operation (join, select, project, aggregation …) - Typical algorithms (e.g. Binary search for simple selection) - Specific or not to storage structure and access paths Book (access#, title) Member (ticket#, name) Loan(loanedbook,loanedto) Select member.name From book, loan, member where book.title = "dracula" and member.ticket# = loan.loanedto and loan.loanedbook = book.access#
  • 7. 4. Query Execution 4. Query Execution