尊敬的 微信汇率:1円 ≈ 0.046166 元 支付宝汇率:1円 ≈ 0.046257元 [退出登录]
SlideShare a Scribd company logo
DDBMS
Assignment Topic:
Query Trees
Distributed Query Optimization
Name:
Shefa Idrees
#101631049
Assignment Submitted to:
BSCS fall-2016
Post Graduate College for Women
Samnabad, Lahore
Query Trees
• A query tree is a tree structure that corresponds to a relational algebra expression such that:
 Each leaf node represents an input relation.
 Each internal node represents a relation obtained by applying one relational operator to
its child nodes.
 The root relation represents the answer to the query.
• It specifies what operations to apply, and the order to apply them, but not how to actually
implement the operations.
• A logical query tree does not select a particular algorithm to implement each relational
operator.
• Two query trees are equivalent if their root relations are the same (query result).
• A query tree may have different execution plans.
• Some query trees and plans are more efficient to execute than others.
Representation
• Query tree is a representation of a select statement.
 Canonical form of select.
• Order of operation in canonical rep.:
 Project
 Select
 Join
The Parser
 The role of the parser is to convert an SQL statement represented as a string of characters
into a parse tree.
 A parse tree consists of nodes, and each node is either an:
 Atom - lexical elements such as words (WHERE), attribute or relation names, constants,
operator symbols, etc.
 Syntactic category - are names for query subparts.
 E.g. <SFW> represents a query in select-from-where form.
 Nodes that are atoms have no children. Nodes that correspond to categories have children
based on one of the rules of the grammar for the language.
General Example:
Parse Trees to Logical Query Trees
Converting Simplest Parse Trees to Logical Query Trees
The simplest parse tree to convert is one where there is only one select-from-where (<SFW>)
construct, and the <Condition> construct has no nested queries.
The logical query tree produced consists of:
 The cross-product (×) of all relations mentioned in the <FromList> which are inputs to:
 A selection operator, σC, where C is the <Condition> expression in the construct being
replaced which is the input to:
 A projection, πL, where L is the list of attributes in the <SelList>
Example 1:
Example 2:
Converting Nested Parse Trees to Logical Query Trees
Converting a parse tree that contains a nested query is slightly more challenging. A nested query
may be correlated with the outside query if it must be re-computed for every tuple produced by
the outside query. Otherwise, it is uncorrelated, and the nested query can be converted to a non-
nested query using joins.
The nested subquery translation algorithm involves defining a tree from root to leaves as
follows:
 Root node is a projection, πL, where L is the list of attributes in the <SelList> of the outer
query.
 Child of root is a selection operator, σC, where C is the <Condition> expression in the
outer query ignoring the subquery.
 The two-operand selection operator σ with left-child as the cross-product (×) of all relations
mentioned in the <FromList> of the outer query, and right child as the <Condition>
expression for the subquery.
 The subquery itself involved in the <Condition> expression is translated to relational
algebra.
Example 3:
Uncorrelated
 Now, we must remove the two-operand selection and replace it by relational algebra
operators.
 Rule for replacing two-operand selection (uncorrelated):
 Let R be the first operand, and the second operand is a <Condition> of the form t IN S. (S
is uncorrelated subquery.)
 Replace <Condition> by the tree that is expression for S.
 May require applying duplicate elimination if expression has duplicates.
 Replace two-operand selection by one-argument selection, σC, where C is the condition
that equates each component of the tuple t to the corresponding attribute of relation S.
 Give σC an argument that is the product of R and S.
So, example 3 becomes:
Correlated
Translating correlated subqueries is more difficult because the result of the subquery depends on
a value defined outside the query itself.
In general, correlated subqueries may require the subquery to be evaluated for each tuple of the
outside relation as an attribute of each tuple is used as the parameter for the subquery.
We will not study translation of correlated subqueries.
Distributed Query Optimization
Dynamic Approach
• The dynamic approach can be illustrated with the algorithm of Distributed INGRES.
• The objective function of the algorithm is to minimize a combination of both the
communication time and the response time.
• However, these two objectives may be conflicting. For instance, increasing communication
time (by means of parallelism) may well decrease response time.
• This query optimization algorithm ignores the cost of transmitting the data to the result
site.
• The algorithm also takes advantage of fragmentation, but only horizontal fragmentation is
handled for simplicity.
• Since both general and broadcast networks are considered, the optimizer takes into account
the network topology.
• In broadcast networks, the same data unit can be transmitted from one site to all the other
sites in a single transfer, and the algorithm explicitly takes advantage of this capability. For
example, broadcasting is used to replicate fragments and then to maximize the degree of
parallelism.
Static Approach
• Static approach can be illustrated with the algorithm of R*.
• This algorithm performs an exhaustive search of all alternative strategies in order to choose
the one with the least cost.
• Although predicting and enumerating these strategies may be costly, the overhead of
exhaustive search is rapidly amortized if the query is executed frequently.
• Two methods are supported for inter-site data transfers.
o Ship-whole. The entire relation is shipped to the join site and stored in a temporary
relation before being joined. If the join algorithm is merge join, the relation does
not need to be stored, and the join site can process incoming tuples in a pipeline
mode, as they arrive.
o Fetch-as-needed. The external relation is sequentially scanned, and for each tuple
the join value is sent to the site of the internal relation, which selects the internal
tuples matching the value and sends the selected tuples to the site of the external
relation. This method is equivalent to the semijoin of the internal relation with each
external tuple.
Semijoin-based Approach
• The semijoin-based approach can be illustrated with the algorithm of SDD-1 which takes
full advantage of the semijoin to minimize communication cost.
Hybrid Approach
• The hybrid query optimization technique using dynamic QEPs is general enough to
incorporate site and copy selection decisions.
• Several hybrid techniques have been proposed to optimize queries in distributed systems.
• They essentially rely on the following two-step approach:
o At compile time, generate a static plan that specifies the ordering of operations and
the access methods, without considering where relations are stored.
o At startup time, generate an execution plan by carrying out site and copy selection
and allocating the operations to the sites.

More Related Content

What's hot

Transaction management DBMS
Transaction  management DBMSTransaction  management DBMS
Transaction management DBMS
Megha Patel
 
First order logic
First order logicFirst order logic
First order logic
Rushdi Shams
 
Iterative deepening search
Iterative deepening searchIterative deepening search
Iterative deepening search
Ashis Kumar Chanda
 
Timestamp based protocol
Timestamp based protocolTimestamp based protocol
Timestamp based protocol
Vincent Chu
 
Production System in AI
Production System in AIProduction System in AI
Production System in AI
Bharat Bhushan
 
Concurrency Control in Database Management System
Concurrency Control in Database Management SystemConcurrency Control in Database Management System
Concurrency Control in Database Management System
Janki Shah
 
Performance analysis(Time & Space Complexity)
Performance analysis(Time & Space Complexity)Performance analysis(Time & Space Complexity)
Performance analysis(Time & Space Complexity)
swapnac12
 
Clustering
ClusteringClustering
Clustering
M Rizwan Aqeel
 
Distributed Query Processing
Distributed Query ProcessingDistributed Query Processing
Distributed Query Processing
Mythili Kannan
 
Anatomy of android application
Anatomy of android applicationAnatomy of android application
Anatomy of android application
Nikunj Dhameliya
 
Greedy Algorihm
Greedy AlgorihmGreedy Algorihm
Greedy Algorihm
Muhammad Amjad Rana
 
Lecture 01 introduction to compiler
Lecture 01 introduction to compilerLecture 01 introduction to compiler
Lecture 01 introduction to compiler
Iffat Anjum
 
13. Query Processing in DBMS
13. Query Processing in DBMS13. Query Processing in DBMS
13. Query Processing in DBMS
koolkampus
 
NOSQL- Presentation on NoSQL
NOSQL- Presentation on NoSQLNOSQL- Presentation on NoSQL
NOSQL- Presentation on NoSQL
Ramakant Soni
 
Matching techniques
Matching techniquesMatching techniques
Matching techniques
Nagpalkirti
 
Query Decomposition and data localization
Query Decomposition and data localization Query Decomposition and data localization
Query Decomposition and data localization
Hafiz faiz
 
Concurrency Control Techniques
Concurrency Control TechniquesConcurrency Control Techniques
Concurrency Control Techniques
Raj vardhan
 
Object persistence
Object persistenceObject persistence
Object persistence
Vlad Vega
 
AI: AI & Problem Solving
AI: AI & Problem SolvingAI: AI & Problem Solving
AI: AI & Problem Solving
DataminingTools Inc
 
Types of Compilers
Types of CompilersTypes of Compilers
Types of Compilers
Hemant Chetwani
 

What's hot (20)

Transaction management DBMS
Transaction  management DBMSTransaction  management DBMS
Transaction management DBMS
 
First order logic
First order logicFirst order logic
First order logic
 
Iterative deepening search
Iterative deepening searchIterative deepening search
Iterative deepening search
 
Timestamp based protocol
Timestamp based protocolTimestamp based protocol
Timestamp based protocol
 
Production System in AI
Production System in AIProduction System in AI
Production System in AI
 
Concurrency Control in Database Management System
Concurrency Control in Database Management SystemConcurrency Control in Database Management System
Concurrency Control in Database Management System
 
Performance analysis(Time & Space Complexity)
Performance analysis(Time & Space Complexity)Performance analysis(Time & Space Complexity)
Performance analysis(Time & Space Complexity)
 
Clustering
ClusteringClustering
Clustering
 
Distributed Query Processing
Distributed Query ProcessingDistributed Query Processing
Distributed Query Processing
 
Anatomy of android application
Anatomy of android applicationAnatomy of android application
Anatomy of android application
 
Greedy Algorihm
Greedy AlgorihmGreedy Algorihm
Greedy Algorihm
 
Lecture 01 introduction to compiler
Lecture 01 introduction to compilerLecture 01 introduction to compiler
Lecture 01 introduction to compiler
 
13. Query Processing in DBMS
13. Query Processing in DBMS13. Query Processing in DBMS
13. Query Processing in DBMS
 
NOSQL- Presentation on NoSQL
NOSQL- Presentation on NoSQLNOSQL- Presentation on NoSQL
NOSQL- Presentation on NoSQL
 
Matching techniques
Matching techniquesMatching techniques
Matching techniques
 
Query Decomposition and data localization
Query Decomposition and data localization Query Decomposition and data localization
Query Decomposition and data localization
 
Concurrency Control Techniques
Concurrency Control TechniquesConcurrency Control Techniques
Concurrency Control Techniques
 
Object persistence
Object persistenceObject persistence
Object persistence
 
AI: AI & Problem Solving
AI: AI & Problem SolvingAI: AI & Problem Solving
AI: AI & Problem Solving
 
Types of Compilers
Types of CompilersTypes of Compilers
Types of Compilers
 

Similar to Query trees

Query processing System
Query processing SystemQuery processing System
Lecture 5.pptx
Lecture 5.pptxLecture 5.pptx
Lecture 5.pptx
Shafii8
 
Query Optimization - Brandon Latronica
Query Optimization - Brandon LatronicaQuery Optimization - Brandon Latronica
Query Optimization - Brandon Latronica
"FENG "GEORGE"" YU
 
Adbms 40 heuristics in query optimization
Adbms 40 heuristics in query optimizationAdbms 40 heuristics in query optimization
Adbms 40 heuristics in query optimization
Vaibhav Khanna
 
Query optimization and processing for advanced database systems
Query optimization and processing for advanced database systemsQuery optimization and processing for advanced database systems
Query optimization and processing for advanced database systems
meharikiros2
 
Transaction Management, Recovery and Query Processing.pptx
Transaction Management, Recovery and Query Processing.pptxTransaction Management, Recovery and Query Processing.pptx
Transaction Management, Recovery and Query Processing.pptx
Roshni814224
 
pdf
pdfpdf
RDBMS
RDBMSRDBMS
RDBMS
sowfi
 
Ica 2013021816274759
Ica 2013021816274759Ica 2013021816274759
Ica 2013021816274759
Valentino Selayan
 
Implementation of query optimization for reducing run time
Implementation of query optimization for reducing run timeImplementation of query optimization for reducing run time
Implementation of query optimization for reducing run time
Alexander Decker
 
Ch-2-Query-Process.pptx advanced database
Ch-2-Query-Process.pptx advanced databaseCh-2-Query-Process.pptx advanced database
Ch-2-Query-Process.pptx advanced database
tasheebedane
 
700442110-advanced database Ch-2-Query-Process.pptx
700442110-advanced database Ch-2-Query-Process.pptx700442110-advanced database Ch-2-Query-Process.pptx
700442110-advanced database Ch-2-Query-Process.pptx
tasheebedane
 
Sedna XML Database: Query Parser & Optimizing Rewriter
Sedna XML Database: Query Parser & Optimizing RewriterSedna XML Database: Query Parser & Optimizing Rewriter
Sedna XML Database: Query Parser & Optimizing Rewriter
Ivan Shcheklein
 
CounterFactual Explanations.pdf
CounterFactual Explanations.pdfCounterFactual Explanations.pdf
CounterFactual Explanations.pdf
Bong-Ho Lee
 
Relational algebra calculus
Relational algebra  calculusRelational algebra  calculus
Relational algebra calculus
Vaibhav Kathuria
 
Phases of distributed query processing
Phases of distributed query processingPhases of distributed query processing
Phases of distributed query processing
Nevil Dsouza
 
8 drived horizontal fragmentation
8  drived horizontal fragmentation8  drived horizontal fragmentation
8 drived horizontal fragmentation
Mohsan Ijaz
 
Extraction Based automatic summarization
Extraction Based automatic summarizationExtraction Based automatic summarization
Extraction Based automatic summarization
Abdelaziz Al-Rihawi
 
Algorithms for Query Processing and Optimization of Spatial Operations
Algorithms for Query Processing and Optimization of Spatial OperationsAlgorithms for Query Processing and Optimization of Spatial Operations
Algorithms for Query Processing and Optimization of Spatial Operations
Natasha Mandal
 
E212d9a797dbms chapter3 b.sc2 (2)
E212d9a797dbms chapter3 b.sc2 (2)E212d9a797dbms chapter3 b.sc2 (2)
E212d9a797dbms chapter3 b.sc2 (2)
Mukund Trivedi
 

Similar to Query trees (20)

Query processing System
Query processing SystemQuery processing System
Query processing System
 
Lecture 5.pptx
Lecture 5.pptxLecture 5.pptx
Lecture 5.pptx
 
Query Optimization - Brandon Latronica
Query Optimization - Brandon LatronicaQuery Optimization - Brandon Latronica
Query Optimization - Brandon Latronica
 
Adbms 40 heuristics in query optimization
Adbms 40 heuristics in query optimizationAdbms 40 heuristics in query optimization
Adbms 40 heuristics in query optimization
 
Query optimization and processing for advanced database systems
Query optimization and processing for advanced database systemsQuery optimization and processing for advanced database systems
Query optimization and processing for advanced database systems
 
Transaction Management, Recovery and Query Processing.pptx
Transaction Management, Recovery and Query Processing.pptxTransaction Management, Recovery and Query Processing.pptx
Transaction Management, Recovery and Query Processing.pptx
 
pdf
pdfpdf
pdf
 
RDBMS
RDBMSRDBMS
RDBMS
 
Ica 2013021816274759
Ica 2013021816274759Ica 2013021816274759
Ica 2013021816274759
 
Implementation of query optimization for reducing run time
Implementation of query optimization for reducing run timeImplementation of query optimization for reducing run time
Implementation of query optimization for reducing run time
 
Ch-2-Query-Process.pptx advanced database
Ch-2-Query-Process.pptx advanced databaseCh-2-Query-Process.pptx advanced database
Ch-2-Query-Process.pptx advanced database
 
700442110-advanced database Ch-2-Query-Process.pptx
700442110-advanced database Ch-2-Query-Process.pptx700442110-advanced database Ch-2-Query-Process.pptx
700442110-advanced database Ch-2-Query-Process.pptx
 
Sedna XML Database: Query Parser & Optimizing Rewriter
Sedna XML Database: Query Parser & Optimizing RewriterSedna XML Database: Query Parser & Optimizing Rewriter
Sedna XML Database: Query Parser & Optimizing Rewriter
 
CounterFactual Explanations.pdf
CounterFactual Explanations.pdfCounterFactual Explanations.pdf
CounterFactual Explanations.pdf
 
Relational algebra calculus
Relational algebra  calculusRelational algebra  calculus
Relational algebra calculus
 
Phases of distributed query processing
Phases of distributed query processingPhases of distributed query processing
Phases of distributed query processing
 
8 drived horizontal fragmentation
8  drived horizontal fragmentation8  drived horizontal fragmentation
8 drived horizontal fragmentation
 
Extraction Based automatic summarization
Extraction Based automatic summarizationExtraction Based automatic summarization
Extraction Based automatic summarization
 
Algorithms for Query Processing and Optimization of Spatial Operations
Algorithms for Query Processing and Optimization of Spatial OperationsAlgorithms for Query Processing and Optimization of Spatial Operations
Algorithms for Query Processing and Optimization of Spatial Operations
 
E212d9a797dbms chapter3 b.sc2 (2)
E212d9a797dbms chapter3 b.sc2 (2)E212d9a797dbms chapter3 b.sc2 (2)
E212d9a797dbms chapter3 b.sc2 (2)
 

More from Shefa Idrees

Tele Communications - IEEE 802.11
Tele Communications - IEEE 802.11Tele Communications - IEEE 802.11
Tele Communications - IEEE 802.11
Shefa Idrees
 
Data Communication IPv6, Ethernet, OSI Model, Transmission Impairments
Data Communication IPv6, Ethernet, OSI Model, Transmission ImpairmentsData Communication IPv6, Ethernet, OSI Model, Transmission Impairments
Data Communication IPv6, Ethernet, OSI Model, Transmission Impairments
Shefa Idrees
 
Interrupts in CPU
Interrupts in CPUInterrupts in CPU
Interrupts in CPU
Shefa Idrees
 
Relational Algebra Operations
Relational Algebra OperationsRelational Algebra Operations
Relational Algebra Operations
Shefa Idrees
 
Description of everything necessary for startup
Description of everything necessary for startupDescription of everything necessary for startup
Description of everything necessary for startup
Shefa Idrees
 
Presentation Skills
Presentation SkillsPresentation Skills
Presentation Skills
Shefa Idrees
 
File Handling in Assembly Prezi slides
File Handling in Assembly Prezi slidesFile Handling in Assembly Prezi slides
File Handling in Assembly Prezi slides
Shefa Idrees
 
Paragraph Types and Ways to Write Them
Paragraph Types and Ways to Write ThemParagraph Types and Ways to Write Them
Paragraph Types and Ways to Write Them
Shefa Idrees
 
Memo Writing
Memo WritingMemo Writing
Memo Writing
Shefa Idrees
 
Cover letters
Cover lettersCover letters
Cover letters
Shefa Idrees
 
Pakistan Foreign Policy...Its objectives and Principles
Pakistan Foreign Policy...Its objectives and PrinciplesPakistan Foreign Policy...Its objectives and Principles
Pakistan Foreign Policy...Its objectives and Principles
Shefa Idrees
 
The constitution of pakistan
The constitution of pakistanThe constitution of pakistan
The constitution of pakistan
Shefa Idrees
 
Report & its types
Report & its typesReport & its types
Report & its types
Shefa Idrees
 
Project proposal
Project proposalProject proposal
Project proposal
Shefa Idrees
 
Model abstract
Model abstractModel abstract
Model abstract
Shefa Idrees
 
Importance & Significance of Islamic Civilization
Importance & Significance of Islamic CivilizationImportance & Significance of Islamic Civilization
Importance & Significance of Islamic Civilization
Shefa Idrees
 
Significance & Importance of Studying the Life of Holy Prophet (S.A.W)
Significance & Importance of Studying the Life of Holy Prophet (S.A.W)Significance & Importance of Studying the Life of Holy Prophet (S.A.W)
Significance & Importance of Studying the Life of Holy Prophet (S.A.W)
Shefa Idrees
 
The Complete Diode Model
The Complete Diode ModelThe Complete Diode Model
The Complete Diode Model
Shefa Idrees
 
Digital Logic & Design
Digital Logic & DesignDigital Logic & Design
Digital Logic & Design
Shefa Idrees
 
Computer Network & Types
Computer Network & TypesComputer Network & Types
Computer Network & Types
Shefa Idrees
 

More from Shefa Idrees (20)

Tele Communications - IEEE 802.11
Tele Communications - IEEE 802.11Tele Communications - IEEE 802.11
Tele Communications - IEEE 802.11
 
Data Communication IPv6, Ethernet, OSI Model, Transmission Impairments
Data Communication IPv6, Ethernet, OSI Model, Transmission ImpairmentsData Communication IPv6, Ethernet, OSI Model, Transmission Impairments
Data Communication IPv6, Ethernet, OSI Model, Transmission Impairments
 
Interrupts in CPU
Interrupts in CPUInterrupts in CPU
Interrupts in CPU
 
Relational Algebra Operations
Relational Algebra OperationsRelational Algebra Operations
Relational Algebra Operations
 
Description of everything necessary for startup
Description of everything necessary for startupDescription of everything necessary for startup
Description of everything necessary for startup
 
Presentation Skills
Presentation SkillsPresentation Skills
Presentation Skills
 
File Handling in Assembly Prezi slides
File Handling in Assembly Prezi slidesFile Handling in Assembly Prezi slides
File Handling in Assembly Prezi slides
 
Paragraph Types and Ways to Write Them
Paragraph Types and Ways to Write ThemParagraph Types and Ways to Write Them
Paragraph Types and Ways to Write Them
 
Memo Writing
Memo WritingMemo Writing
Memo Writing
 
Cover letters
Cover lettersCover letters
Cover letters
 
Pakistan Foreign Policy...Its objectives and Principles
Pakistan Foreign Policy...Its objectives and PrinciplesPakistan Foreign Policy...Its objectives and Principles
Pakistan Foreign Policy...Its objectives and Principles
 
The constitution of pakistan
The constitution of pakistanThe constitution of pakistan
The constitution of pakistan
 
Report & its types
Report & its typesReport & its types
Report & its types
 
Project proposal
Project proposalProject proposal
Project proposal
 
Model abstract
Model abstractModel abstract
Model abstract
 
Importance & Significance of Islamic Civilization
Importance & Significance of Islamic CivilizationImportance & Significance of Islamic Civilization
Importance & Significance of Islamic Civilization
 
Significance & Importance of Studying the Life of Holy Prophet (S.A.W)
Significance & Importance of Studying the Life of Holy Prophet (S.A.W)Significance & Importance of Studying the Life of Holy Prophet (S.A.W)
Significance & Importance of Studying the Life of Holy Prophet (S.A.W)
 
The Complete Diode Model
The Complete Diode ModelThe Complete Diode Model
The Complete Diode Model
 
Digital Logic & Design
Digital Logic & DesignDigital Logic & Design
Digital Logic & Design
 
Computer Network & Types
Computer Network & TypesComputer Network & Types
Computer Network & Types
 

Recently uploaded

How GenAI Can Improve Supplier Performance Management.pdf
How GenAI Can Improve Supplier Performance Management.pdfHow GenAI Can Improve Supplier Performance Management.pdf
How GenAI Can Improve Supplier Performance Management.pdf
Zycus
 
1 Million Orange Stickies later - Devoxx Poland 2024
1 Million Orange Stickies later - Devoxx Poland 20241 Million Orange Stickies later - Devoxx Poland 2024
1 Million Orange Stickies later - Devoxx Poland 2024
Alberto Brandolini
 
Strengthening Web Development with CommandBox 6: Seamless Transition and Scal...
Strengthening Web Development with CommandBox 6: Seamless Transition and Scal...Strengthening Web Development with CommandBox 6: Seamless Transition and Scal...
Strengthening Web Development with CommandBox 6: Seamless Transition and Scal...
Ortus Solutions, Corp
 
AI Based Testing - A Comprehensive Guide.pdf
AI Based Testing - A Comprehensive Guide.pdfAI Based Testing - A Comprehensive Guide.pdf
AI Based Testing - A Comprehensive Guide.pdf
kalichargn70th171
 
Independent Call Girls In Bangalore 💯Call Us 🔝 7426014248 🔝Independent Bangal...
Independent Call Girls In Bangalore 💯Call Us 🔝 7426014248 🔝Independent Bangal...Independent Call Girls In Bangalore 💯Call Us 🔝 7426014248 🔝Independent Bangal...
Independent Call Girls In Bangalore 💯Call Us 🔝 7426014248 🔝Independent Bangal...
sapnasaifi408
 
Hi-Fi Call Girls In Hyderabad 💯Call Us 🔝 7426014248 🔝Independent Hyderabad Es...
Hi-Fi Call Girls In Hyderabad 💯Call Us 🔝 7426014248 🔝Independent Hyderabad Es...Hi-Fi Call Girls In Hyderabad 💯Call Us 🔝 7426014248 🔝Independent Hyderabad Es...
Hi-Fi Call Girls In Hyderabad 💯Call Us 🔝 7426014248 🔝Independent Hyderabad Es...
sapnasaifi408
 
Introduction to Python and Basic Syntax.pptx
Introduction to Python and Basic Syntax.pptxIntroduction to Python and Basic Syntax.pptx
Introduction to Python and Basic Syntax.pptx
GevitaChinnaiah
 
Solar Panel Service Provider annual maintenance contract.pdf
Solar Panel Service Provider annual maintenance contract.pdfSolar Panel Service Provider annual maintenance contract.pdf
Solar Panel Service Provider annual maintenance contract.pdf
SERVE WELL CRM NASHIK
 
Independent Call Girls In Kolkata ✔ 7014168258 ✔ Hi I Am Divya Vip Call Girl ...
Independent Call Girls In Kolkata ✔ 7014168258 ✔ Hi I Am Divya Vip Call Girl ...Independent Call Girls In Kolkata ✔ 7014168258 ✔ Hi I Am Divya Vip Call Girl ...
Independent Call Girls In Kolkata ✔ 7014168258 ✔ Hi I Am Divya Vip Call Girl ...
simmi singh$A17
 
Extreme DDD Modelling Patterns - 2024 Devoxx Poland
Extreme DDD Modelling Patterns - 2024 Devoxx PolandExtreme DDD Modelling Patterns - 2024 Devoxx Poland
Extreme DDD Modelling Patterns - 2024 Devoxx Poland
Alberto Brandolini
 
Photo Copier Xerox Machine annual maintenance contract system.pdf
Photo Copier Xerox Machine annual maintenance contract system.pdfPhoto Copier Xerox Machine annual maintenance contract system.pdf
Photo Copier Xerox Machine annual maintenance contract system.pdf
SERVE WELL CRM NASHIK
 
Call Girls Bangalore🔥7023059433🔥Best Profile Escorts in Bangalore Available 24/7
Call Girls Bangalore🔥7023059433🔥Best Profile Escorts in Bangalore Available 24/7Call Girls Bangalore🔥7023059433🔥Best Profile Escorts in Bangalore Available 24/7
Call Girls Bangalore🔥7023059433🔥Best Profile Escorts in Bangalore Available 24/7
manji sharman06
 
SAP ECC & S4 HANA PPT COMPARISON MM.pptx
SAP ECC & S4 HANA PPT COMPARISON MM.pptxSAP ECC & S4 HANA PPT COMPARISON MM.pptx
SAP ECC & S4 HANA PPT COMPARISON MM.pptx
aneeshmanikantan2341
 
Enhancing non-Perl bioinformatic applications with Perl
Enhancing non-Perl bioinformatic applications with PerlEnhancing non-Perl bioinformatic applications with Perl
Enhancing non-Perl bioinformatic applications with Perl
Christos Argyropoulos
 
Hyperledger Besu 빨리 따라하기 (Private Networks)
Hyperledger Besu 빨리 따라하기 (Private Networks)Hyperledger Besu 빨리 따라하기 (Private Networks)
Hyperledger Besu 빨리 따라하기 (Private Networks)
wonyong hwang
 
Digital Marketing Introduction and Conclusion
Digital Marketing Introduction and ConclusionDigital Marketing Introduction and Conclusion
Digital Marketing Introduction and Conclusion
Staff AgentAI
 
Premium Call Girls In Ahmedabad 💯Call Us 🔝 7426014248 🔝Independent Ahmedabad ...
Premium Call Girls In Ahmedabad 💯Call Us 🔝 7426014248 🔝Independent Ahmedabad ...Premium Call Girls In Ahmedabad 💯Call Us 🔝 7426014248 🔝Independent Ahmedabad ...
Premium Call Girls In Ahmedabad 💯Call Us 🔝 7426014248 🔝Independent Ahmedabad ...
Anita pandey
 
Folding Cheat Sheet #6 - sixth in a series
Folding Cheat Sheet #6 - sixth in a seriesFolding Cheat Sheet #6 - sixth in a series
Folding Cheat Sheet #6 - sixth in a series
Philip Schwarz
 
Ensuring Efficiency and Speed with Practical Solutions for Clinical Operations
Ensuring Efficiency and Speed with Practical Solutions for Clinical OperationsEnsuring Efficiency and Speed with Practical Solutions for Clinical Operations
Ensuring Efficiency and Speed with Practical Solutions for Clinical Operations
OnePlan Solutions
 
Erotic Call Girls Bangalore🫱9079923931🫲 High Quality Call Girl Service Right ...
Erotic Call Girls Bangalore🫱9079923931🫲 High Quality Call Girl Service Right ...Erotic Call Girls Bangalore🫱9079923931🫲 High Quality Call Girl Service Right ...
Erotic Call Girls Bangalore🫱9079923931🫲 High Quality Call Girl Service Right ...
meenusingh4354543
 

Recently uploaded (20)

How GenAI Can Improve Supplier Performance Management.pdf
How GenAI Can Improve Supplier Performance Management.pdfHow GenAI Can Improve Supplier Performance Management.pdf
How GenAI Can Improve Supplier Performance Management.pdf
 
1 Million Orange Stickies later - Devoxx Poland 2024
1 Million Orange Stickies later - Devoxx Poland 20241 Million Orange Stickies later - Devoxx Poland 2024
1 Million Orange Stickies later - Devoxx Poland 2024
 
Strengthening Web Development with CommandBox 6: Seamless Transition and Scal...
Strengthening Web Development with CommandBox 6: Seamless Transition and Scal...Strengthening Web Development with CommandBox 6: Seamless Transition and Scal...
Strengthening Web Development with CommandBox 6: Seamless Transition and Scal...
 
AI Based Testing - A Comprehensive Guide.pdf
AI Based Testing - A Comprehensive Guide.pdfAI Based Testing - A Comprehensive Guide.pdf
AI Based Testing - A Comprehensive Guide.pdf
 
Independent Call Girls In Bangalore 💯Call Us 🔝 7426014248 🔝Independent Bangal...
Independent Call Girls In Bangalore 💯Call Us 🔝 7426014248 🔝Independent Bangal...Independent Call Girls In Bangalore 💯Call Us 🔝 7426014248 🔝Independent Bangal...
Independent Call Girls In Bangalore 💯Call Us 🔝 7426014248 🔝Independent Bangal...
 
Hi-Fi Call Girls In Hyderabad 💯Call Us 🔝 7426014248 🔝Independent Hyderabad Es...
Hi-Fi Call Girls In Hyderabad 💯Call Us 🔝 7426014248 🔝Independent Hyderabad Es...Hi-Fi Call Girls In Hyderabad 💯Call Us 🔝 7426014248 🔝Independent Hyderabad Es...
Hi-Fi Call Girls In Hyderabad 💯Call Us 🔝 7426014248 🔝Independent Hyderabad Es...
 
Introduction to Python and Basic Syntax.pptx
Introduction to Python and Basic Syntax.pptxIntroduction to Python and Basic Syntax.pptx
Introduction to Python and Basic Syntax.pptx
 
Solar Panel Service Provider annual maintenance contract.pdf
Solar Panel Service Provider annual maintenance contract.pdfSolar Panel Service Provider annual maintenance contract.pdf
Solar Panel Service Provider annual maintenance contract.pdf
 
Independent Call Girls In Kolkata ✔ 7014168258 ✔ Hi I Am Divya Vip Call Girl ...
Independent Call Girls In Kolkata ✔ 7014168258 ✔ Hi I Am Divya Vip Call Girl ...Independent Call Girls In Kolkata ✔ 7014168258 ✔ Hi I Am Divya Vip Call Girl ...
Independent Call Girls In Kolkata ✔ 7014168258 ✔ Hi I Am Divya Vip Call Girl ...
 
Extreme DDD Modelling Patterns - 2024 Devoxx Poland
Extreme DDD Modelling Patterns - 2024 Devoxx PolandExtreme DDD Modelling Patterns - 2024 Devoxx Poland
Extreme DDD Modelling Patterns - 2024 Devoxx Poland
 
Photo Copier Xerox Machine annual maintenance contract system.pdf
Photo Copier Xerox Machine annual maintenance contract system.pdfPhoto Copier Xerox Machine annual maintenance contract system.pdf
Photo Copier Xerox Machine annual maintenance contract system.pdf
 
Call Girls Bangalore🔥7023059433🔥Best Profile Escorts in Bangalore Available 24/7
Call Girls Bangalore🔥7023059433🔥Best Profile Escorts in Bangalore Available 24/7Call Girls Bangalore🔥7023059433🔥Best Profile Escorts in Bangalore Available 24/7
Call Girls Bangalore🔥7023059433🔥Best Profile Escorts in Bangalore Available 24/7
 
SAP ECC & S4 HANA PPT COMPARISON MM.pptx
SAP ECC & S4 HANA PPT COMPARISON MM.pptxSAP ECC & S4 HANA PPT COMPARISON MM.pptx
SAP ECC & S4 HANA PPT COMPARISON MM.pptx
 
Enhancing non-Perl bioinformatic applications with Perl
Enhancing non-Perl bioinformatic applications with PerlEnhancing non-Perl bioinformatic applications with Perl
Enhancing non-Perl bioinformatic applications with Perl
 
Hyperledger Besu 빨리 따라하기 (Private Networks)
Hyperledger Besu 빨리 따라하기 (Private Networks)Hyperledger Besu 빨리 따라하기 (Private Networks)
Hyperledger Besu 빨리 따라하기 (Private Networks)
 
Digital Marketing Introduction and Conclusion
Digital Marketing Introduction and ConclusionDigital Marketing Introduction and Conclusion
Digital Marketing Introduction and Conclusion
 
Premium Call Girls In Ahmedabad 💯Call Us 🔝 7426014248 🔝Independent Ahmedabad ...
Premium Call Girls In Ahmedabad 💯Call Us 🔝 7426014248 🔝Independent Ahmedabad ...Premium Call Girls In Ahmedabad 💯Call Us 🔝 7426014248 🔝Independent Ahmedabad ...
Premium Call Girls In Ahmedabad 💯Call Us 🔝 7426014248 🔝Independent Ahmedabad ...
 
Folding Cheat Sheet #6 - sixth in a series
Folding Cheat Sheet #6 - sixth in a seriesFolding Cheat Sheet #6 - sixth in a series
Folding Cheat Sheet #6 - sixth in a series
 
Ensuring Efficiency and Speed with Practical Solutions for Clinical Operations
Ensuring Efficiency and Speed with Practical Solutions for Clinical OperationsEnsuring Efficiency and Speed with Practical Solutions for Clinical Operations
Ensuring Efficiency and Speed with Practical Solutions for Clinical Operations
 
Erotic Call Girls Bangalore🫱9079923931🫲 High Quality Call Girl Service Right ...
Erotic Call Girls Bangalore🫱9079923931🫲 High Quality Call Girl Service Right ...Erotic Call Girls Bangalore🫱9079923931🫲 High Quality Call Girl Service Right ...
Erotic Call Girls Bangalore🫱9079923931🫲 High Quality Call Girl Service Right ...
 

Query trees

  • 1. DDBMS Assignment Topic: Query Trees Distributed Query Optimization Name: Shefa Idrees #101631049 Assignment Submitted to: BSCS fall-2016 Post Graduate College for Women Samnabad, Lahore
  • 2. Query Trees • A query tree is a tree structure that corresponds to a relational algebra expression such that:  Each leaf node represents an input relation.  Each internal node represents a relation obtained by applying one relational operator to its child nodes.  The root relation represents the answer to the query. • It specifies what operations to apply, and the order to apply them, but not how to actually implement the operations. • A logical query tree does not select a particular algorithm to implement each relational operator. • Two query trees are equivalent if their root relations are the same (query result). • A query tree may have different execution plans. • Some query trees and plans are more efficient to execute than others. Representation • Query tree is a representation of a select statement.  Canonical form of select. • Order of operation in canonical rep.:  Project  Select  Join The Parser  The role of the parser is to convert an SQL statement represented as a string of characters into a parse tree.  A parse tree consists of nodes, and each node is either an:  Atom - lexical elements such as words (WHERE), attribute or relation names, constants, operator symbols, etc.  Syntactic category - are names for query subparts.  E.g. <SFW> represents a query in select-from-where form.  Nodes that are atoms have no children. Nodes that correspond to categories have children based on one of the rules of the grammar for the language.
  • 3. General Example: Parse Trees to Logical Query Trees Converting Simplest Parse Trees to Logical Query Trees The simplest parse tree to convert is one where there is only one select-from-where (<SFW>) construct, and the <Condition> construct has no nested queries. The logical query tree produced consists of:  The cross-product (×) of all relations mentioned in the <FromList> which are inputs to:  A selection operator, σC, where C is the <Condition> expression in the construct being replaced which is the input to:  A projection, πL, where L is the list of attributes in the <SelList>
  • 5. Converting Nested Parse Trees to Logical Query Trees Converting a parse tree that contains a nested query is slightly more challenging. A nested query may be correlated with the outside query if it must be re-computed for every tuple produced by the outside query. Otherwise, it is uncorrelated, and the nested query can be converted to a non- nested query using joins. The nested subquery translation algorithm involves defining a tree from root to leaves as follows:  Root node is a projection, πL, where L is the list of attributes in the <SelList> of the outer query.  Child of root is a selection operator, σC, where C is the <Condition> expression in the outer query ignoring the subquery.  The two-operand selection operator σ with left-child as the cross-product (×) of all relations mentioned in the <FromList> of the outer query, and right child as the <Condition> expression for the subquery.  The subquery itself involved in the <Condition> expression is translated to relational algebra. Example 3:
  • 6. Uncorrelated  Now, we must remove the two-operand selection and replace it by relational algebra operators.  Rule for replacing two-operand selection (uncorrelated):  Let R be the first operand, and the second operand is a <Condition> of the form t IN S. (S is uncorrelated subquery.)  Replace <Condition> by the tree that is expression for S.  May require applying duplicate elimination if expression has duplicates.  Replace two-operand selection by one-argument selection, σC, where C is the condition that equates each component of the tuple t to the corresponding attribute of relation S.  Give σC an argument that is the product of R and S.
  • 7. So, example 3 becomes: Correlated Translating correlated subqueries is more difficult because the result of the subquery depends on a value defined outside the query itself. In general, correlated subqueries may require the subquery to be evaluated for each tuple of the outside relation as an attribute of each tuple is used as the parameter for the subquery. We will not study translation of correlated subqueries. Distributed Query Optimization Dynamic Approach • The dynamic approach can be illustrated with the algorithm of Distributed INGRES. • The objective function of the algorithm is to minimize a combination of both the communication time and the response time. • However, these two objectives may be conflicting. For instance, increasing communication time (by means of parallelism) may well decrease response time. • This query optimization algorithm ignores the cost of transmitting the data to the result site.
  • 8. • The algorithm also takes advantage of fragmentation, but only horizontal fragmentation is handled for simplicity. • Since both general and broadcast networks are considered, the optimizer takes into account the network topology. • In broadcast networks, the same data unit can be transmitted from one site to all the other sites in a single transfer, and the algorithm explicitly takes advantage of this capability. For example, broadcasting is used to replicate fragments and then to maximize the degree of parallelism. Static Approach • Static approach can be illustrated with the algorithm of R*. • This algorithm performs an exhaustive search of all alternative strategies in order to choose the one with the least cost. • Although predicting and enumerating these strategies may be costly, the overhead of exhaustive search is rapidly amortized if the query is executed frequently. • Two methods are supported for inter-site data transfers. o Ship-whole. The entire relation is shipped to the join site and stored in a temporary relation before being joined. If the join algorithm is merge join, the relation does not need to be stored, and the join site can process incoming tuples in a pipeline mode, as they arrive. o Fetch-as-needed. The external relation is sequentially scanned, and for each tuple the join value is sent to the site of the internal relation, which selects the internal tuples matching the value and sends the selected tuples to the site of the external relation. This method is equivalent to the semijoin of the internal relation with each external tuple. Semijoin-based Approach • The semijoin-based approach can be illustrated with the algorithm of SDD-1 which takes full advantage of the semijoin to minimize communication cost. Hybrid Approach • The hybrid query optimization technique using dynamic QEPs is general enough to incorporate site and copy selection decisions.
  • 9. • Several hybrid techniques have been proposed to optimize queries in distributed systems. • They essentially rely on the following two-step approach: o At compile time, generate a static plan that specifies the ordering of operations and the access methods, without considering where relations are stored. o At startup time, generate an execution plan by carrying out site and copy selection and allocating the operations to the sites.
  翻译: