SlideShare a Scribd company logo
1 of 7
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

Similar to 1 query processing

LECTURE_06_DATABASE PROCESSING & OPTIMAZATION.pptx
LECTURE_06_DATABASE PROCESSING & OPTIMAZATION.pptxLECTURE_06_DATABASE PROCESSING & OPTIMAZATION.pptx
LECTURE_06_DATABASE PROCESSING & OPTIMAZATION.pptx
AthosBeatus
 
Overview of query evaluation
Overview of query evaluationOverview of query evaluation
Overview of query evaluation
avniS
 
Intelligent query converter a domain independent interfacefor conversion
Intelligent query converter a domain independent interfacefor conversionIntelligent query converter a domain independent interfacefor conversion
Intelligent query converter a domain independent interfacefor conversion
IAEME Publication
 

Similar to 1 query processing (20)

Query processing
Query processingQuery processing
Query processing
 
LECTURE_06_DATABASE PROCESSING & OPTIMAZATION.pptx
LECTURE_06_DATABASE PROCESSING & OPTIMAZATION.pptxLECTURE_06_DATABASE PROCESSING & OPTIMAZATION.pptx
LECTURE_06_DATABASE PROCESSING & OPTIMAZATION.pptx
 
Query optimization and performance
Query optimization and performanceQuery optimization and performance
Query optimization and performance
 
Query optimization and performance
Query optimization and performanceQuery optimization and performance
Query optimization and performance
 
Overview of query evaluation
Overview of query evaluationOverview of query evaluation
Overview of query evaluation
 
QueryProcessingAndOptimization-Part 1.pptx
QueryProcessingAndOptimization-Part 1.pptxQueryProcessingAndOptimization-Part 1.pptx
QueryProcessingAndOptimization-Part 1.pptx
 
Mc seminar
Mc seminarMc seminar
Mc seminar
 
Presentación Oracle Database Migración consideraciones 10g/11g/12c
Presentación Oracle Database Migración consideraciones 10g/11g/12cPresentación Oracle Database Migración consideraciones 10g/11g/12c
Presentación Oracle Database Migración consideraciones 10g/11g/12c
 
Query Decomposition and data localization
Query Decomposition and data localization Query Decomposition and data localization
Query Decomposition and data localization
 
Top-k Exploration of Query Candidates for Efficient Keyword Search on Graph-S...
Top-k Exploration of Query Candidates for Efficient Keyword Search on Graph-S...Top-k Exploration of Query Candidates for Efficient Keyword Search on Graph-S...
Top-k Exploration of Query Candidates for Efficient Keyword Search on Graph-S...
 
Expressive Querying of Semantic Databases with Incremental Query Rewriting
Expressive Querying of Semantic Databases with Incremental Query RewritingExpressive Querying of Semantic Databases with Incremental Query Rewriting
Expressive Querying of Semantic Databases with Incremental Query Rewriting
 
Distributed DBMS - Unit 6 - Query Processing
Distributed DBMS - Unit 6 - Query ProcessingDistributed DBMS - Unit 6 - Query Processing
Distributed DBMS - Unit 6 - Query Processing
 
Lecture 5.pptx
Lecture 5.pptxLecture 5.pptx
Lecture 5.pptx
 
Deep Dive : Spark Data Frames, SQL and Catalyst Optimizer
Deep Dive : Spark Data Frames, SQL and Catalyst OptimizerDeep Dive : Spark Data Frames, SQL and Catalyst Optimizer
Deep Dive : Spark Data Frames, SQL and Catalyst Optimizer
 
JDBC Connectivity Model
JDBC Connectivity ModelJDBC Connectivity Model
JDBC Connectivity Model
 
Intelligent query converter a domain independent interfacefor conversion
Intelligent query converter a domain independent interfacefor conversionIntelligent query converter a domain independent interfacefor conversion
Intelligent query converter a domain independent interfacefor conversion
 
Query processing
Query processingQuery processing
Query processing
 
Database part2-
Database part2-Database part2-
Database part2-
 
MODULE 5.pptx
MODULE 5.pptxMODULE 5.pptx
MODULE 5.pptx
 
Search Quality Evaluation to Help Reproducibility : an Open Source Approach
Search Quality Evaluation to Help Reproducibility : an Open Source ApproachSearch Quality Evaluation to Help Reproducibility : an Open Source Approach
Search Quality Evaluation to Help Reproducibility : an Open Source Approach
 

More from Mr Patrick NIYISHAKA (20)

Summary
SummarySummary
Summary
 
3 summary
3 summary3 summary
3 summary
 
2 ddb architecture
2 ddb architecture2 ddb architecture
2 ddb architecture
 
1 ddb
1 ddb1 ddb
1 ddb
 
2 countermeasures
2 countermeasures2 countermeasures
2 countermeasures
 
2 countermeasures
2 countermeasures2 countermeasures
2 countermeasures
 
3 summary
3 summary3 summary
3 summary
 
1 db security
1 db security1 db security
1 db security
 
4 summary
4 summary4 summary
4 summary
 
3 summary
3 summary3 summary
3 summary
 
2 con control
2 con control2 con control
2 con control
 
1 con exe
1 con exe1 con exe
1 con exe
 
1 basic concepts
1 basic concepts1 basic concepts
1 basic concepts
 
2 recovery
2 recovery2 recovery
2 recovery
 
3 transaction
3 transaction3 transaction
3 transaction
 
3 summary
3 summary3 summary
3 summary
 
1 query processing
1 query processing1 query processing
1 query processing
 
2 optimization
2 optimization2 optimization
2 optimization
 
2 collision
2 collision2 collision
2 collision
 
4 summary
4 summary4 summary
4 summary
 

Recently uploaded

Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 

Recently uploaded (20)

General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptx
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Asian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptxAsian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptx
 

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