SlideShare a Scribd company logo
G.H Patel College of Engineering and 
Technology 
Department Of Computer Engineering 
DATABASE MANGMENT SYSTEM (2130703)
• QUERY EVALUATION PLAN 
G.H Patel College of Engg and Technology, Department Of Computer Engineering 2
ename (on the fly) 
planeId=100 AND rating>5 (on the fly) 
(nested loops) 
(file scan) Employees Maintenances (file scan) 
Method 
to use 
Sometimes it might 
be possible, to 
pipeline the result of 
one operator to 
another operator 
without creating a 
temporary table 
for the intermediate 
result. 
This saves in cost. 
When the input to a 
unary operator (e.g.  
or ) is pipelined into 
it, we say the 
operator is applied 
on-the-fly. 
G.H Patel College of Engg and Technology, Department Of Computer Engineering 3
• 
G.H Patel College of Engg and Technology, Department Of Computer Engineering 4
ename (on the fly) 
planeId=100 AND rating>5 (on the fly) 
Maintenances 
(file scan) 
(nested loops join) 
Employees 
(file scan) 
Cost for this plan: 
300,000 I/Os for the join. 
 and  are done in the fly; no 
I/O cost for them. 
G.H Patel College of Engg and Technology, Department Of Computer Engineering 5
ename (on the fly) 
planeId=100 AND rating>5 (on the fly) 
Maintenances 
(file scan) 
(sort merge join) 
Employees 
(file scan) 
Cost for this plan: 
7,500 I/Os for the join. 
 and  are done in the fly; no 
I/O cost for them. 
G.H Patel College of Engg and Technology, Department Of Computer Engineering 6
• 
• 
• 
• 
• 
G.H Patel College of Engg and Technology, Department Of Computer Engineering 7
• 
• 
G.H Patel College of Engg and Technology, Department Of Computer Engineering 8
• 
• 
• 
G.H Patel College of Engg and Technology, Department Of Computer Engineering 9
FOR EXAMPLE: 
SELECT * FROM STAFF WHERE ID = (SELECT MAX(MANAGER) FROM ORG) 
IN THIS STATEMENT, THE SUBQUERY NEEDS TO BE EVALUATED ONLY ONCE. 
THIS TYPE OF SUBQUERY MUST RETURN ONLY ONE ROW. IF EVALUATING THE SUBQUERY 
CAUSES A CARDINALITY VIOLATION (IF IT RETURNS MORE THAN ONE ROW), AN EXCEPTION IS 
THROWN WHEN THE SUBQUERY IS RUN. 
G.H Patel College of Engg and Technology, Department Of Computer Engineering 10
SUBQUERY MATERIALIZATION IS DETECTED BEFORE OPTIMIZATION, WHICH ALLOWS THE 
DERBY OPTIMIZER TO SEE A MATERIALIZED SUBQUERY AS AN UNKNOWN CONSTANT VALUE. 
THE COMPARISON IS THEREFORE OPTIMIZABLE. 
THE ORIGINAL STATEMENT IS TRANSFORMED INTO THE FOLLOWING TWO STATEMENTS: 
CONSTANT = SELECT MAX(MANAGER) FROM ORG SELECT * FROM STAFF WHERE ID 
= CONSTANT 
THE SECOND STATEMENT IS OPTIMIZABLE. 
G.H Patel College of Engg and Technology, Department Of Computer Engineering 11
• 
• 
• 
• 
G.H Patel College of Engg and Technology, Department Of Computer Engineering 12
G.H Patel College of Engg and Technology, Department Of Computer Engineering 13
• 
• 
• 
• 
• 
• 
G.H Patel College of Engg and Technology, Department Of Computer Engineering 14
• 
• 
• 
• 
• 
G.H Patel College of Engg and Technology, Department Of Computer Engineering 15
Employees (sin INT, ename VARCHAR(20), rating INT, age REAL) 
Maintenances (sin INT, planeId INT, day DATE, descCode 
CHAR(10)) 
SELECT ename 
FROM Employees NATURAL JOIN Maintenances 
WHERE planeId = 100 AND rating > 5; 
ename (planeId=100 AND rating>5 (Employees Maintenances)) 
G.H Patel College of Engg and Technology, Department Of Computer Engineering 16
ename 
planeId=100 AND rating>5 
RA expressions can 
are represented by 
an expression tree. 
Maintenances Employees 
An algorithm is 
chosen for each 
node in the 
expression tree. 
G.H Patel College of Engg and Technology, Department Of Computer Engineering 17
• 
• QUERY EVALUATION PLANS 
• 
• 
• 
• QUERY OPTIMIZATION. 
G.H Patel College of Engg and Technology, Department Of Computer Engineering 18
• CLUSTERING INDEX 
• "PRIMARY" 
• NON-CLUSTERING INDEX 
• "SECONDARY" 
G.H Patel College of Engg and Technology, Department Of Computer Engineering 19
EMPLOYEES 
MAINTENANCES 
• 
• 
• 
• 1000 
• 
• 
• 
• 500 
G.H Patel College of Engg and Technology, Department Of Computer Engineering 20
R.ATTR = VALUE (R) 
• 
• 
• 
• 
• 
R.ATTR < VALUE (R) 
• WHY? 
• 
G.H Patel College of Engg and Technology, Department Of Computer Engineering 21
• 
• THAT’S EASY 
• 
• THIS IS MORE EXPENSIVE 
• 
• 
G.H Patel College of Engg and Technology, Department Of Computer Engineering 22
• 
• 
INDEX NESTED LOOPS JOIN 
• SIN 
• 
• ANALYSIS 
• 
• 
• 300,000 I/OS 
G.H Patel College of Engg and Technology, Department Of Computer Engineering 23
SORT-MERGE 
• 
• ANALYSIS 
• MAINTENANCES EMPLOYEES 
• 
• MAINTENANCES 
• EMPLOYEES 
• 
• (MUCH BETTER!!) 
G.H Patel College of Engg and Technology, Department Of Computer Engineering 24
• INDEX NESTED LOOPS JOIN 
• SORT-MERGE JOIN 
• WHY BOTHER WITH INDEX NESTED LOOPS JOIN? 
• INDEX NESTED LOOPS 
• MAINTENANCES 
• 
MAINTENANCES MAINTENANCES 
EMPLOYEES 
G.H Patel College of Engg and Technology, Department Of Computer Engineering 25
• 
• MAINTENANCES EMPLOYEES 
• MAINTENANCES 
• 
G.H Patel College of Engg and Technology, Department Of Computer Engineering 26
• OBSERVE THAT THE CHOICE OF INDEX NESTED LOOPS JOIN IS BASED ON CONSIDERING THE QUERY 
AS A WHOLE, INCLUDING THE EXTRA SELECTION ON MAINTENANCES, RATHER THAN JUST THE JOIN 
OPERATION BY ITSELF. 
• QUERY OPTIMIZATION 
• 
G.H Patel College of Engg and Technology, Department Of Computer Engineering 27
• 
• 
G.H Patel College of Engg and Technology, Department Of Computer Engineering 28
G.H Patel College of Engg and Technology, Department Of Computer Engineering 29
Evaluation of Expression in Query Processing
Ad

More Related Content

What's hot (20)

Deadlock dbms
Deadlock dbmsDeadlock dbms
Deadlock dbms
Vardhil Patel
 
serializability in dbms
serializability in dbmsserializability in dbms
serializability in dbms
Saranya Natarajan
 
Advanced sql
Advanced sqlAdvanced sql
Advanced sql
Dhani Ahmad
 
set operators.pptx
set operators.pptxset operators.pptx
set operators.pptx
Anusha sivakumar
 
First and follow set
First and follow setFirst and follow set
First and follow set
Dawood Faheem Abbasi
 
Dbms lab Manual
Dbms lab ManualDbms lab Manual
Dbms lab Manual
Vivek Kumar Sinha
 
Compiler Design Unit 4
Compiler Design Unit 4Compiler Design Unit 4
Compiler Design Unit 4
Jena Catherine Bel D
 
Informed search algorithms.pptx
Informed search algorithms.pptxInformed search algorithms.pptx
Informed search algorithms.pptx
Dr.Shweta
 
Intermediate code generation in Compiler Design
Intermediate code generation in Compiler DesignIntermediate code generation in Compiler Design
Intermediate code generation in Compiler Design
Kuppusamy P
 
vdocument.in_prof-saroj-kaushik1-introduction-to-artificial-intelligence-lect...
vdocument.in_prof-saroj-kaushik1-introduction-to-artificial-intelligence-lect...vdocument.in_prof-saroj-kaushik1-introduction-to-artificial-intelligence-lect...
vdocument.in_prof-saroj-kaushik1-introduction-to-artificial-intelligence-lect...
akshaya870130
 
Structure of dbms
Structure of dbmsStructure of dbms
Structure of dbms
Megha yadav
 
Clustering in data Mining (Data Mining)
Clustering in data Mining (Data Mining)Clustering in data Mining (Data Mining)
Clustering in data Mining (Data Mining)
Mustafa Sherazi
 
Distributed DBMS - Unit 5 - Semantic Data Control
Distributed DBMS - Unit 5 - Semantic Data ControlDistributed DBMS - Unit 5 - Semantic Data Control
Distributed DBMS - Unit 5 - Semantic Data Control
Gyanmanjari Institute Of Technology
 
joins in database
 joins in database joins in database
joins in database
Sultan Arshad
 
Unit3:Informed and Uninformed search
Unit3:Informed and Uninformed searchUnit3:Informed and Uninformed search
Unit3:Informed and Uninformed search
Tekendra Nath Yogi
 
Map Reduce
Map ReduceMap Reduce
Map Reduce
Prashant Gupta
 
Algorithms Lecture 7: Graph Algorithms
Algorithms Lecture 7: Graph AlgorithmsAlgorithms Lecture 7: Graph Algorithms
Algorithms Lecture 7: Graph Algorithms
Mohamed Loey
 
SQL
SQLSQL
SQL
Galaxyy Pandey
 
Symbol table in compiler Design
Symbol table in compiler DesignSymbol table in compiler Design
Symbol table in compiler Design
Kuppusamy P
 
Schedule in DBMS
Schedule in DBMSSchedule in DBMS
Schedule in DBMS
PratibhaRashmiSingh
 
Informed search algorithms.pptx
Informed search algorithms.pptxInformed search algorithms.pptx
Informed search algorithms.pptx
Dr.Shweta
 
Intermediate code generation in Compiler Design
Intermediate code generation in Compiler DesignIntermediate code generation in Compiler Design
Intermediate code generation in Compiler Design
Kuppusamy P
 
vdocument.in_prof-saroj-kaushik1-introduction-to-artificial-intelligence-lect...
vdocument.in_prof-saroj-kaushik1-introduction-to-artificial-intelligence-lect...vdocument.in_prof-saroj-kaushik1-introduction-to-artificial-intelligence-lect...
vdocument.in_prof-saroj-kaushik1-introduction-to-artificial-intelligence-lect...
akshaya870130
 
Structure of dbms
Structure of dbmsStructure of dbms
Structure of dbms
Megha yadav
 
Clustering in data Mining (Data Mining)
Clustering in data Mining (Data Mining)Clustering in data Mining (Data Mining)
Clustering in data Mining (Data Mining)
Mustafa Sherazi
 
Unit3:Informed and Uninformed search
Unit3:Informed and Uninformed searchUnit3:Informed and Uninformed search
Unit3:Informed and Uninformed search
Tekendra Nath Yogi
 
Algorithms Lecture 7: Graph Algorithms
Algorithms Lecture 7: Graph AlgorithmsAlgorithms Lecture 7: Graph Algorithms
Algorithms Lecture 7: Graph Algorithms
Mohamed Loey
 
Symbol table in compiler Design
Symbol table in compiler DesignSymbol table in compiler Design
Symbol table in compiler Design
Kuppusamy P
 

Viewers also liked (6)

Schemaless Databases
Schemaless DatabasesSchemaless Databases
Schemaless Databases
Dan Gunter
 
Query Processing and Optimisation - Lecture 10 - Introduction to Databases (1...
Query Processing and Optimisation - Lecture 10 - Introduction to Databases (1...Query Processing and Optimisation - Lecture 10 - Introduction to Databases (1...
Query Processing and Optimisation - Lecture 10 - Introduction to Databases (1...
Beat Signer
 
Cultivation theory
Cultivation theoryCultivation theory
Cultivation theory
Minh Dieu Hoang
 
Introduction to Graph Databases
Introduction to Graph DatabasesIntroduction to Graph Databases
Introduction to Graph Databases
Max De Marzi
 
Materials handling
Materials handlingMaterials handling
Materials handling
Rohit Verma
 
Green house ppt
Green house pptGreen house ppt
Green house ppt
Taherbond
 
Schemaless Databases
Schemaless DatabasesSchemaless Databases
Schemaless Databases
Dan Gunter
 
Query Processing and Optimisation - Lecture 10 - Introduction to Databases (1...
Query Processing and Optimisation - Lecture 10 - Introduction to Databases (1...Query Processing and Optimisation - Lecture 10 - Introduction to Databases (1...
Query Processing and Optimisation - Lecture 10 - Introduction to Databases (1...
Beat Signer
 
Introduction to Graph Databases
Introduction to Graph DatabasesIntroduction to Graph Databases
Introduction to Graph Databases
Max De Marzi
 
Materials handling
Materials handlingMaterials handling
Materials handling
Rohit Verma
 
Green house ppt
Green house pptGreen house ppt
Green house ppt
Taherbond
 
Ad

Similar to Evaluation of Expression in Query Processing (20)

Application of or for industrial engineers
Application of or for industrial engineersApplication of or for industrial engineers
Application of or for industrial engineers
Hakeem-Ur- Rehman
 
Boetticher Presentation Promise 2008v2
Boetticher Presentation Promise 2008v2Boetticher Presentation Promise 2008v2
Boetticher Presentation Promise 2008v2
gregoryg
 
Assessing the Reliability of a Human Estimator
Assessing the Reliability of a Human EstimatorAssessing the Reliability of a Human Estimator
Assessing the Reliability of a Human Estimator
Tim Menzies
 
Optimization of process parameter for maximizing Material removal rate in tur...
Optimization of process parameter for maximizing Material removal rate in tur...Optimization of process parameter for maximizing Material removal rate in tur...
Optimization of process parameter for maximizing Material removal rate in tur...
IRJET Journal
 
CS8080_IRT_UNIT - III T8 FEATURE SELECTION OR DIMENSIONALITY REDUCTION.pdf
CS8080_IRT_UNIT - III T8  FEATURE SELECTION OR DIMENSIONALITY REDUCTION.pdfCS8080_IRT_UNIT - III T8  FEATURE SELECTION OR DIMENSIONALITY REDUCTION.pdf
CS8080_IRT_UNIT - III T8 FEATURE SELECTION OR DIMENSIONALITY REDUCTION.pdf
AALIM MUHAMMED SALEGH COLLEGE OF ENGINEERING
 
Functional verification techniques EW16 session
Functional verification techniques  EW16 sessionFunctional verification techniques  EW16 session
Functional verification techniques EW16 session
Sameh El-Ashry
 
Multi-Response Optimization of Aluminum alloy using GRA & PCA by employing Ta...
Multi-Response Optimization of Aluminum alloy using GRA & PCA by employing Ta...Multi-Response Optimization of Aluminum alloy using GRA & PCA by employing Ta...
Multi-Response Optimization of Aluminum alloy using GRA & PCA by employing Ta...
IRJET Journal
 
M.tech. mechanical engineering 2016 17
M.tech. mechanical engineering 2016 17M.tech. mechanical engineering 2016 17
M.tech. mechanical engineering 2016 17
Piyush Pant
 
MySQL Optimizer Overview
MySQL Optimizer OverviewMySQL Optimizer Overview
MySQL Optimizer Overview
Olav Sandstå
 
Derivación y aplicación de un Modelo de Estimación de Costos para la Ingenier...
Derivación y aplicación de un Modelo de Estimación de Costos para la Ingenier...Derivación y aplicación de un Modelo de Estimación de Costos para la Ingenier...
Derivación y aplicación de un Modelo de Estimación de Costos para la Ingenier...
Academia de Ingeniería de México
 
JavaMicroBenchmarkpptm
JavaMicroBenchmarkpptmJavaMicroBenchmarkpptm
JavaMicroBenchmarkpptm
Srinivasan Raghavan
 
Resume - Balaji. P
Resume - Balaji. PResume - Balaji. P
Resume - Balaji. P
Balaji P
 
CSEG1001Unit 2 C Programming Fundamentals
CSEG1001Unit 2 C Programming FundamentalsCSEG1001Unit 2 C Programming Fundamentals
CSEG1001Unit 2 C Programming Fundamentals
Dhiviya Rose
 
greedy algorithm the concept of Design & Analysis of Algorithms.pdf
greedy algorithm the concept of Design & Analysis of Algorithms.pdfgreedy algorithm the concept of Design & Analysis of Algorithms.pdf
greedy algorithm the concept of Design & Analysis of Algorithms.pdf
gotafim135
 
Imitation Learning
Imitation LearningImitation Learning
Imitation Learning
Anirban Santara
 
Whhrhsgbfsbgstbaetgaegaagbabrhreek 6.pptx
Whhrhsgbfsbgstbaetgaegaagbabrhreek 6.pptxWhhrhsgbfsbgstbaetgaegaagbabrhreek 6.pptx
Whhrhsgbfsbgstbaetgaegaagbabrhreek 6.pptx
sirholmezz
 
Using Bayesian Optimization to Tune Machine Learning Models
Using Bayesian Optimization to Tune Machine Learning ModelsUsing Bayesian Optimization to Tune Machine Learning Models
Using Bayesian Optimization to Tune Machine Learning Models
SigOpt
 
Using Bayesian Optimization to Tune Machine Learning Models
Using Bayesian Optimization to Tune Machine Learning ModelsUsing Bayesian Optimization to Tune Machine Learning Models
Using Bayesian Optimization to Tune Machine Learning Models
Scott Clark
 
Establishing A Defect Prediction Model Using A Combination of Product Metrics...
Establishing A Defect Prediction Model Using A Combination of Product Metrics...Establishing A Defect Prediction Model Using A Combination of Product Metrics...
Establishing A Defect Prediction Model Using A Combination of Product Metrics...
MIMOS Berhad/Open University Malaysia/Universiti Teknologi Malaysia
 
Integration of Analytical Software and 3D Platform in Plant Design and Engine...
Integration of Analytical Software and 3D Platform in Plant Design and Engine...Integration of Analytical Software and 3D Platform in Plant Design and Engine...
Integration of Analytical Software and 3D Platform in Plant Design and Engine...
Anirban Datta, CEng
 
Application of or for industrial engineers
Application of or for industrial engineersApplication of or for industrial engineers
Application of or for industrial engineers
Hakeem-Ur- Rehman
 
Boetticher Presentation Promise 2008v2
Boetticher Presentation Promise 2008v2Boetticher Presentation Promise 2008v2
Boetticher Presentation Promise 2008v2
gregoryg
 
Assessing the Reliability of a Human Estimator
Assessing the Reliability of a Human EstimatorAssessing the Reliability of a Human Estimator
Assessing the Reliability of a Human Estimator
Tim Menzies
 
Optimization of process parameter for maximizing Material removal rate in tur...
Optimization of process parameter for maximizing Material removal rate in tur...Optimization of process parameter for maximizing Material removal rate in tur...
Optimization of process parameter for maximizing Material removal rate in tur...
IRJET Journal
 
Functional verification techniques EW16 session
Functional verification techniques  EW16 sessionFunctional verification techniques  EW16 session
Functional verification techniques EW16 session
Sameh El-Ashry
 
Multi-Response Optimization of Aluminum alloy using GRA & PCA by employing Ta...
Multi-Response Optimization of Aluminum alloy using GRA & PCA by employing Ta...Multi-Response Optimization of Aluminum alloy using GRA & PCA by employing Ta...
Multi-Response Optimization of Aluminum alloy using GRA & PCA by employing Ta...
IRJET Journal
 
M.tech. mechanical engineering 2016 17
M.tech. mechanical engineering 2016 17M.tech. mechanical engineering 2016 17
M.tech. mechanical engineering 2016 17
Piyush Pant
 
MySQL Optimizer Overview
MySQL Optimizer OverviewMySQL Optimizer Overview
MySQL Optimizer Overview
Olav Sandstå
 
Derivación y aplicación de un Modelo de Estimación de Costos para la Ingenier...
Derivación y aplicación de un Modelo de Estimación de Costos para la Ingenier...Derivación y aplicación de un Modelo de Estimación de Costos para la Ingenier...
Derivación y aplicación de un Modelo de Estimación de Costos para la Ingenier...
Academia de Ingeniería de México
 
Resume - Balaji. P
Resume - Balaji. PResume - Balaji. P
Resume - Balaji. P
Balaji P
 
CSEG1001Unit 2 C Programming Fundamentals
CSEG1001Unit 2 C Programming FundamentalsCSEG1001Unit 2 C Programming Fundamentals
CSEG1001Unit 2 C Programming Fundamentals
Dhiviya Rose
 
greedy algorithm the concept of Design & Analysis of Algorithms.pdf
greedy algorithm the concept of Design & Analysis of Algorithms.pdfgreedy algorithm the concept of Design & Analysis of Algorithms.pdf
greedy algorithm the concept of Design & Analysis of Algorithms.pdf
gotafim135
 
Whhrhsgbfsbgstbaetgaegaagbabrhreek 6.pptx
Whhrhsgbfsbgstbaetgaegaagbabrhreek 6.pptxWhhrhsgbfsbgstbaetgaegaagbabrhreek 6.pptx
Whhrhsgbfsbgstbaetgaegaagbabrhreek 6.pptx
sirholmezz
 
Using Bayesian Optimization to Tune Machine Learning Models
Using Bayesian Optimization to Tune Machine Learning ModelsUsing Bayesian Optimization to Tune Machine Learning Models
Using Bayesian Optimization to Tune Machine Learning Models
SigOpt
 
Using Bayesian Optimization to Tune Machine Learning Models
Using Bayesian Optimization to Tune Machine Learning ModelsUsing Bayesian Optimization to Tune Machine Learning Models
Using Bayesian Optimization to Tune Machine Learning Models
Scott Clark
 
Integration of Analytical Software and 3D Platform in Plant Design and Engine...
Integration of Analytical Software and 3D Platform in Plant Design and Engine...Integration of Analytical Software and 3D Platform in Plant Design and Engine...
Integration of Analytical Software and 3D Platform in Plant Design and Engine...
Anirban Datta, CEng
 
Ad

Recently uploaded (20)

AI-Powered Data Management and Governance in Retail
AI-Powered Data Management and Governance in RetailAI-Powered Data Management and Governance in Retail
AI-Powered Data Management and Governance in Retail
IJDKP
 
twin tower attack 2001 new york city
twin  tower  attack  2001 new  york citytwin  tower  attack  2001 new  york city
twin tower attack 2001 new york city
harishreemavs
 
22PCOAM16_MACHINE_LEARNING_UNIT_IV_NOTES_with_QB
22PCOAM16_MACHINE_LEARNING_UNIT_IV_NOTES_with_QB22PCOAM16_MACHINE_LEARNING_UNIT_IV_NOTES_with_QB
22PCOAM16_MACHINE_LEARNING_UNIT_IV_NOTES_with_QB
Guru Nanak Technical Institutions
 
Frontend Architecture Diagram/Guide For Frontend Engineers
Frontend Architecture Diagram/Guide For Frontend EngineersFrontend Architecture Diagram/Guide For Frontend Engineers
Frontend Architecture Diagram/Guide For Frontend Engineers
Michael Hertzberg
 
ATAL 6 Days Online FDP Scheme Document 2025-26.pdf
ATAL 6 Days Online FDP Scheme Document 2025-26.pdfATAL 6 Days Online FDP Scheme Document 2025-26.pdf
ATAL 6 Days Online FDP Scheme Document 2025-26.pdf
ssuserda39791
 
Environment .................................
Environment .................................Environment .................................
Environment .................................
shadyozq9
 
Little Known Ways To 3 Best sites to Buy Linkedin Accounts.pdf
Little Known Ways To 3 Best sites to Buy Linkedin Accounts.pdfLittle Known Ways To 3 Best sites to Buy Linkedin Accounts.pdf
Little Known Ways To 3 Best sites to Buy Linkedin Accounts.pdf
gori42199
 
Control Methods of Noise Pollutions.pptx
Control Methods of Noise Pollutions.pptxControl Methods of Noise Pollutions.pptx
Control Methods of Noise Pollutions.pptx
vvsasane
 
IBAAS 2023 Series_Lecture 8- Dr. Nandi.pdf
IBAAS 2023 Series_Lecture 8- Dr. Nandi.pdfIBAAS 2023 Series_Lecture 8- Dr. Nandi.pdf
IBAAS 2023 Series_Lecture 8- Dr. Nandi.pdf
VigneshPalaniappanM
 
Machine foundation notes for civil engineering students
Machine foundation notes for civil engineering studentsMachine foundation notes for civil engineering students
Machine foundation notes for civil engineering students
DYPCET
 
Agents chapter of Artificial intelligence
Agents chapter of Artificial intelligenceAgents chapter of Artificial intelligence
Agents chapter of Artificial intelligence
DebdeepMukherjee9
 
acid base ppt and their specific application in food
acid base ppt and their specific application in foodacid base ppt and their specific application in food
acid base ppt and their specific application in food
Fatehatun Noor
 
Machine Learning basics POWERPOINT PRESENETATION
Machine Learning basics POWERPOINT PRESENETATIONMachine Learning basics POWERPOINT PRESENETATION
Machine Learning basics POWERPOINT PRESENETATION
DarrinBright1
 
Personal Protective Efsgfgsffquipment.ppt
Personal Protective Efsgfgsffquipment.pptPersonal Protective Efsgfgsffquipment.ppt
Personal Protective Efsgfgsffquipment.ppt
ganjangbegu579
 
OPTIMIZING DATA INTEROPERABILITY IN AGILE ORGANIZATIONS: INTEGRATING NONAKA’S...
OPTIMIZING DATA INTEROPERABILITY IN AGILE ORGANIZATIONS: INTEGRATING NONAKA’S...OPTIMIZING DATA INTEROPERABILITY IN AGILE ORGANIZATIONS: INTEGRATING NONAKA’S...
OPTIMIZING DATA INTEROPERABILITY IN AGILE ORGANIZATIONS: INTEGRATING NONAKA’S...
ijdmsjournal
 
01.คุณลักษณะเฉพาะของอุปกรณ์_pagenumber.pdf
01.คุณลักษณะเฉพาะของอุปกรณ์_pagenumber.pdf01.คุณลักษณะเฉพาะของอุปกรณ์_pagenumber.pdf
01.คุณลักษณะเฉพาะของอุปกรณ์_pagenumber.pdf
PawachMetharattanara
 
Generative AI & Large Language Models Agents
Generative AI & Large Language Models AgentsGenerative AI & Large Language Models Agents
Generative AI & Large Language Models Agents
aasgharbee22seecs
 
ML_Unit_VI_DEEP LEARNING_Introduction to ANN.pdf
ML_Unit_VI_DEEP LEARNING_Introduction to ANN.pdfML_Unit_VI_DEEP LEARNING_Introduction to ANN.pdf
ML_Unit_VI_DEEP LEARNING_Introduction to ANN.pdf
rameshwarchintamani
 
Construction Materials (Paints) in Civil Engineering
Construction Materials (Paints) in Civil EngineeringConstruction Materials (Paints) in Civil Engineering
Construction Materials (Paints) in Civil Engineering
Lavish Kashyap
 
David Boutry - Specializes In AWS, Microservices And Python
David Boutry - Specializes In AWS, Microservices And PythonDavid Boutry - Specializes In AWS, Microservices And Python
David Boutry - Specializes In AWS, Microservices And Python
David Boutry
 
AI-Powered Data Management and Governance in Retail
AI-Powered Data Management and Governance in RetailAI-Powered Data Management and Governance in Retail
AI-Powered Data Management and Governance in Retail
IJDKP
 
twin tower attack 2001 new york city
twin  tower  attack  2001 new  york citytwin  tower  attack  2001 new  york city
twin tower attack 2001 new york city
harishreemavs
 
Frontend Architecture Diagram/Guide For Frontend Engineers
Frontend Architecture Diagram/Guide For Frontend EngineersFrontend Architecture Diagram/Guide For Frontend Engineers
Frontend Architecture Diagram/Guide For Frontend Engineers
Michael Hertzberg
 
ATAL 6 Days Online FDP Scheme Document 2025-26.pdf
ATAL 6 Days Online FDP Scheme Document 2025-26.pdfATAL 6 Days Online FDP Scheme Document 2025-26.pdf
ATAL 6 Days Online FDP Scheme Document 2025-26.pdf
ssuserda39791
 
Environment .................................
Environment .................................Environment .................................
Environment .................................
shadyozq9
 
Little Known Ways To 3 Best sites to Buy Linkedin Accounts.pdf
Little Known Ways To 3 Best sites to Buy Linkedin Accounts.pdfLittle Known Ways To 3 Best sites to Buy Linkedin Accounts.pdf
Little Known Ways To 3 Best sites to Buy Linkedin Accounts.pdf
gori42199
 
Control Methods of Noise Pollutions.pptx
Control Methods of Noise Pollutions.pptxControl Methods of Noise Pollutions.pptx
Control Methods of Noise Pollutions.pptx
vvsasane
 
IBAAS 2023 Series_Lecture 8- Dr. Nandi.pdf
IBAAS 2023 Series_Lecture 8- Dr. Nandi.pdfIBAAS 2023 Series_Lecture 8- Dr. Nandi.pdf
IBAAS 2023 Series_Lecture 8- Dr. Nandi.pdf
VigneshPalaniappanM
 
Machine foundation notes for civil engineering students
Machine foundation notes for civil engineering studentsMachine foundation notes for civil engineering students
Machine foundation notes for civil engineering students
DYPCET
 
Agents chapter of Artificial intelligence
Agents chapter of Artificial intelligenceAgents chapter of Artificial intelligence
Agents chapter of Artificial intelligence
DebdeepMukherjee9
 
acid base ppt and their specific application in food
acid base ppt and their specific application in foodacid base ppt and their specific application in food
acid base ppt and their specific application in food
Fatehatun Noor
 
Machine Learning basics POWERPOINT PRESENETATION
Machine Learning basics POWERPOINT PRESENETATIONMachine Learning basics POWERPOINT PRESENETATION
Machine Learning basics POWERPOINT PRESENETATION
DarrinBright1
 
Personal Protective Efsgfgsffquipment.ppt
Personal Protective Efsgfgsffquipment.pptPersonal Protective Efsgfgsffquipment.ppt
Personal Protective Efsgfgsffquipment.ppt
ganjangbegu579
 
OPTIMIZING DATA INTEROPERABILITY IN AGILE ORGANIZATIONS: INTEGRATING NONAKA’S...
OPTIMIZING DATA INTEROPERABILITY IN AGILE ORGANIZATIONS: INTEGRATING NONAKA’S...OPTIMIZING DATA INTEROPERABILITY IN AGILE ORGANIZATIONS: INTEGRATING NONAKA’S...
OPTIMIZING DATA INTEROPERABILITY IN AGILE ORGANIZATIONS: INTEGRATING NONAKA’S...
ijdmsjournal
 
01.คุณลักษณะเฉพาะของอุปกรณ์_pagenumber.pdf
01.คุณลักษณะเฉพาะของอุปกรณ์_pagenumber.pdf01.คุณลักษณะเฉพาะของอุปกรณ์_pagenumber.pdf
01.คุณลักษณะเฉพาะของอุปกรณ์_pagenumber.pdf
PawachMetharattanara
 
Generative AI & Large Language Models Agents
Generative AI & Large Language Models AgentsGenerative AI & Large Language Models Agents
Generative AI & Large Language Models Agents
aasgharbee22seecs
 
ML_Unit_VI_DEEP LEARNING_Introduction to ANN.pdf
ML_Unit_VI_DEEP LEARNING_Introduction to ANN.pdfML_Unit_VI_DEEP LEARNING_Introduction to ANN.pdf
ML_Unit_VI_DEEP LEARNING_Introduction to ANN.pdf
rameshwarchintamani
 
Construction Materials (Paints) in Civil Engineering
Construction Materials (Paints) in Civil EngineeringConstruction Materials (Paints) in Civil Engineering
Construction Materials (Paints) in Civil Engineering
Lavish Kashyap
 
David Boutry - Specializes In AWS, Microservices And Python
David Boutry - Specializes In AWS, Microservices And PythonDavid Boutry - Specializes In AWS, Microservices And Python
David Boutry - Specializes In AWS, Microservices And Python
David Boutry
 

Evaluation of Expression in Query Processing

  • 1. G.H Patel College of Engineering and Technology Department Of Computer Engineering DATABASE MANGMENT SYSTEM (2130703)
  • 2. • QUERY EVALUATION PLAN G.H Patel College of Engg and Technology, Department Of Computer Engineering 2
  • 3. ename (on the fly) planeId=100 AND rating>5 (on the fly) (nested loops) (file scan) Employees Maintenances (file scan) Method to use Sometimes it might be possible, to pipeline the result of one operator to another operator without creating a temporary table for the intermediate result. This saves in cost. When the input to a unary operator (e.g.  or ) is pipelined into it, we say the operator is applied on-the-fly. G.H Patel College of Engg and Technology, Department Of Computer Engineering 3
  • 4. • G.H Patel College of Engg and Technology, Department Of Computer Engineering 4
  • 5. ename (on the fly) planeId=100 AND rating>5 (on the fly) Maintenances (file scan) (nested loops join) Employees (file scan) Cost for this plan: 300,000 I/Os for the join.  and  are done in the fly; no I/O cost for them. G.H Patel College of Engg and Technology, Department Of Computer Engineering 5
  • 6. ename (on the fly) planeId=100 AND rating>5 (on the fly) Maintenances (file scan) (sort merge join) Employees (file scan) Cost for this plan: 7,500 I/Os for the join.  and  are done in the fly; no I/O cost for them. G.H Patel College of Engg and Technology, Department Of Computer Engineering 6
  • 7. • • • • • G.H Patel College of Engg and Technology, Department Of Computer Engineering 7
  • 8. • • G.H Patel College of Engg and Technology, Department Of Computer Engineering 8
  • 9. • • • G.H Patel College of Engg and Technology, Department Of Computer Engineering 9
  • 10. FOR EXAMPLE: SELECT * FROM STAFF WHERE ID = (SELECT MAX(MANAGER) FROM ORG) IN THIS STATEMENT, THE SUBQUERY NEEDS TO BE EVALUATED ONLY ONCE. THIS TYPE OF SUBQUERY MUST RETURN ONLY ONE ROW. IF EVALUATING THE SUBQUERY CAUSES A CARDINALITY VIOLATION (IF IT RETURNS MORE THAN ONE ROW), AN EXCEPTION IS THROWN WHEN THE SUBQUERY IS RUN. G.H Patel College of Engg and Technology, Department Of Computer Engineering 10
  • 11. SUBQUERY MATERIALIZATION IS DETECTED BEFORE OPTIMIZATION, WHICH ALLOWS THE DERBY OPTIMIZER TO SEE A MATERIALIZED SUBQUERY AS AN UNKNOWN CONSTANT VALUE. THE COMPARISON IS THEREFORE OPTIMIZABLE. THE ORIGINAL STATEMENT IS TRANSFORMED INTO THE FOLLOWING TWO STATEMENTS: CONSTANT = SELECT MAX(MANAGER) FROM ORG SELECT * FROM STAFF WHERE ID = CONSTANT THE SECOND STATEMENT IS OPTIMIZABLE. G.H Patel College of Engg and Technology, Department Of Computer Engineering 11
  • 12. • • • • G.H Patel College of Engg and Technology, Department Of Computer Engineering 12
  • 13. G.H Patel College of Engg and Technology, Department Of Computer Engineering 13
  • 14. • • • • • • G.H Patel College of Engg and Technology, Department Of Computer Engineering 14
  • 15. • • • • • G.H Patel College of Engg and Technology, Department Of Computer Engineering 15
  • 16. Employees (sin INT, ename VARCHAR(20), rating INT, age REAL) Maintenances (sin INT, planeId INT, day DATE, descCode CHAR(10)) SELECT ename FROM Employees NATURAL JOIN Maintenances WHERE planeId = 100 AND rating > 5; ename (planeId=100 AND rating>5 (Employees Maintenances)) G.H Patel College of Engg and Technology, Department Of Computer Engineering 16
  • 17. ename planeId=100 AND rating>5 RA expressions can are represented by an expression tree. Maintenances Employees An algorithm is chosen for each node in the expression tree. G.H Patel College of Engg and Technology, Department Of Computer Engineering 17
  • 18. • • QUERY EVALUATION PLANS • • • • QUERY OPTIMIZATION. G.H Patel College of Engg and Technology, Department Of Computer Engineering 18
  • 19. • CLUSTERING INDEX • "PRIMARY" • NON-CLUSTERING INDEX • "SECONDARY" G.H Patel College of Engg and Technology, Department Of Computer Engineering 19
  • 20. EMPLOYEES MAINTENANCES • • • • 1000 • • • • 500 G.H Patel College of Engg and Technology, Department Of Computer Engineering 20
  • 21. R.ATTR = VALUE (R) • • • • • R.ATTR < VALUE (R) • WHY? • G.H Patel College of Engg and Technology, Department Of Computer Engineering 21
  • 22. • • THAT’S EASY • • THIS IS MORE EXPENSIVE • • G.H Patel College of Engg and Technology, Department Of Computer Engineering 22
  • 23. • • INDEX NESTED LOOPS JOIN • SIN • • ANALYSIS • • • 300,000 I/OS G.H Patel College of Engg and Technology, Department Of Computer Engineering 23
  • 24. SORT-MERGE • • ANALYSIS • MAINTENANCES EMPLOYEES • • MAINTENANCES • EMPLOYEES • • (MUCH BETTER!!) G.H Patel College of Engg and Technology, Department Of Computer Engineering 24
  • 25. • INDEX NESTED LOOPS JOIN • SORT-MERGE JOIN • WHY BOTHER WITH INDEX NESTED LOOPS JOIN? • INDEX NESTED LOOPS • MAINTENANCES • MAINTENANCES MAINTENANCES EMPLOYEES G.H Patel College of Engg and Technology, Department Of Computer Engineering 25
  • 26. • • MAINTENANCES EMPLOYEES • MAINTENANCES • G.H Patel College of Engg and Technology, Department Of Computer Engineering 26
  • 27. • OBSERVE THAT THE CHOICE OF INDEX NESTED LOOPS JOIN IS BASED ON CONSIDERING THE QUERY AS A WHOLE, INCLUDING THE EXTRA SELECTION ON MAINTENANCES, RATHER THAN JUST THE JOIN OPERATION BY ITSELF. • QUERY OPTIMIZATION • G.H Patel College of Engg and Technology, Department Of Computer Engineering 27
  • 28. • • G.H Patel College of Engg and Technology, Department Of Computer Engineering 28
  • 29. G.H Patel College of Engg and Technology, Department Of Computer Engineering 29
  翻译: