SlideShare a Scribd company logo
1 of 23
UNIT-6
Query Processing
Outlines…
• Introduction of Query Processing
• Query Processing Problem
• Layer of Query Processing
• Query Processing in Centralized Systems
• Query Processing in Distributed Systems
1/11/2017 2Prof. Dhaval R. Chandarana
Introduction of Query Processing
• Query processing in a distributed context is to transform a high-level
query on a distributed database, which is seen as a single database by
the users, into an efficient execution strategy expressed in a low-level
language on local databases.
• The main function of a relational query processor is to transform a
high-level query (typically, in relational calculus) into an equivalent
lower-level query (typically, in some variation of relational algebra).
1/11/2017 3Prof. Dhaval R. Chandarana
Query Processing Problem
• The main difficulty is to select the execution strategy that minimizes
resource consumption.
• The low-level query actually implements the execution strategy for
the query. The transformation must achieve both correctness and
efficiency.
• It is correct if the low-level query has the same semantics as the
original query, that is, if both queries produce the same result.
• The well-defined mapping from relational calculus to relational
algebra makes the correctness issue easy.
1/11/2017 4Prof. Dhaval R. Chandarana
Query Processing Example
• Example: Transformation of an SQL-query into an RA-query.
Relations: EMP(ENO, ENAME, TITLE), ASG(ENO,PNO,RESP,DUR)
Query: Find the names of employees who are managing a project?
– High level query
SELECT ENAME
FROM EMP,ASG
WHERE EMP.ENO = ASG.ENO AND DUR > 37
– Two possible transformations of the query are:
• Expression 1: ENAME(DUR>37∧EMP.ENO=ASG.ENO(EMP × ASG))
• Expression 2: ENAME(EMP ⋊⋉ENO (DUR>37(ASG)))
– Expression 2 avoids the expensive and large intermediate Cartesian
product, and therefore typically is better.
1/11/2017 5Prof. Dhaval R. Chandarana
Query Processing Example
• We make the following assumptions about the data fragmentation
– Data is (horizontally) fragmented:
• Site1: ASG1 = ENO≤”E3”(ASG)
• Site2: ASG2 = ENO>”E3”(ASG)
• Site3: EMP1 = ENO≤”E3”(EMP)
• Site4: EMP2 = ENO>”E3”(EMP)
• Site5: Result
• Relations ASG and EMP are fragmented in the same way
• Relations ASG and EMP are locally clustered on attributes RESP and ENO,
• respectively
1/11/2017 6Prof. Dhaval R. Chandarana
1/11/2017 7Prof. Dhaval R. Chandarana
1/11/2017 8Prof. Dhaval R. Chandarana
LayerofQueryProcessing
1/11/2017 9Prof. Dhaval R. Chandarana
Query Decomposition
• The first layer decomposes the calculus query into an algebraic query
on global relations. The information needed for this transformation is
found in the global conceptual schema describing the global relations.
• Query decomposition can be viewed as four successive steps.
• First, the calculus query is rewritten in a normalized form that is
suitable for subsequent manipulation. Normalization of a query
generally involves the manipulation of the query quantifiers and of
the query qualification by applying logical operator priority.
• Second, the normalized query is analyzed semantically so that
incorrect queries are detected and rejected as early as possible.
Techniques to detect incorrect queries exist only for a subset of
relational calculus. Typically, they use some sort of graph that
captures the semantics of the query.
1/11/2017 10Prof. Dhaval R. Chandarana
Query Decomposition
• Third, the correct query (still expressed in relational calculus) is
simplified. One way to simplify a query is to eliminate redundant
predicates. Note that redundant queries are likely to arise when a
query is the result of system transformations applied to the user
query. such transformations are used for performing semantic data
control (views, protection, and semantic integrity control).
• Fourth, the calculus query is restructured as an algebraic query. The
traditional way to do this transformation toward a “better” algebraic
specification is to start with an initial algebraic query and transform it
in order to find a “go
• The algebraic query generated by this layer is good in the sense that
the worse executions are typically avoided.
1/11/2017 11Prof. Dhaval R. Chandarana
Data Localization
• The input to the second layer is an algebraic query on global relations. The
main role of the second layer is to localize the query’s data using data
distribution information in the fragment schema.
• This layer determines which fragments are involved in the query and
transforms the distributed query into a query on fragments.
• A global relation can be reconstructed by applying the fragmentation rules,
and then deriving a program, called a localization program, of relational
algebra operators, which then act on fragments.
• Generating a query on fragments is done in two steps
• First, the query is mapped into a fragment query by substituting each relation by its
reconstruction program (also called materialization program).
• Second, the fragment query is simplified and restructured to produce another
“good” query.
1/11/2017 12Prof. Dhaval R. Chandarana
Global Query Optimization
• The input to the third layer is an algebraic query on fragments. The goal of
query optimization is to find an execution strategy for the query which is
close to optimal.
• The previous layers have already optimized the query, for example, by
eliminating redundant expressions. However, this optimization is
independent of fragment characteristics such as fragment allocation and
cardinalities.
• Query optimization consists of finding the “best” ordering of operators in
the query, including communication operators that minimize a cost
function.
• The output of the query optimization layer is a optimized algebraic query
with communication operators included on fragments. It is typically
represented and saved (for future executions) as a distributed query
execution plan .
1/11/2017 13Prof. Dhaval R. Chandarana
Distributed Query Execution
• The last layer is performed by all the sites having fragments involved
in the query.
• Each sub query executing at one site, called a local query, is then
optimized using the local schema of the site and executed.
1/11/2017 14Prof. Dhaval R. Chandarana
Characterization of Query Processors
• The input language to the query processor can be based on relational
calculus or relational algebra.
• Query optimization is to select a best point of solution space that
leads to the minimum cost.
• Optimization can be done statically before executing the query or
dynamically as the query is executed.
• Dynamic query optimization requires statistics in order to choose the
operation that has to be done first.
• Static query optimization requires statistics to estimate the size of
intermediate relations.
• Distributed query processor exploits the network topology.
1/11/2017 15Prof. Dhaval R. Chandarana
Query Processing in Centralized Systems
• Goal of query processor in centralized system is:
1. Minimize the query response time.
2. Maximize the parallelism in the system
3. Maximize the system throughput.
• In centralized DBMS query processing consists of four steps:
1. Query decomposition
2. Query optimization
3. Code generation
4. Query execution
1/11/2017 16Prof. Dhaval R. Chandarana
Query Processing in Centralized Systems
Query
Decomposing
Query
Optimization
Code
generation
Runtime query
execution
Output
SQL
Query
System
catalog
Database
statistics
Main
Database
1/11/2017 17Prof. Dhaval R. Chandarana
Query Processing in Distributed Systems
• In a distributed DBMS the catalog has to store additional information
including the location of relations and their replicas. The catalog must also
include system wise information such as the number of site in the system
along with their identifiers'.
1/11/2017 18Prof. Dhaval R. Chandarana
Mapping Global Query to Local
• The tables required in a global query have fragments distributed across
multiple sites. The local databases have information only about local data.
The controlling site uses the global data dictionary to gather information
about the distribution and reconstructs the global view from the
fragments.
• If there is no replication, the global optimizer runs local queries at the sites
where the fragments are stored. If there is replication, the global optimizer
selects the site based upon communication cost, workload, and server
speed.
1/11/2017 19Prof. Dhaval R. Chandarana
Mapping Global Query to Local
• The global optimizer generates a distributed execution plan so that least
amount of data transfer occurs across the sites. The plan states the
location of the fragments, order in which query steps needs to be
executed and the processes involved in transferring intermediate results.
• The local queries are optimized by the local database servers. Finally, the
local query results are merged together through union operation in case of
horizontal fragments and join operation for vertical fragments.
1/11/2017 20Prof. Dhaval R. Chandarana
Example
• For example, let us consider that the following Project schema is
horizontally fragmented according to City, the cities being New Delhi,
Kolkata and Hyderabad.
• PROJECT
• Suppose there is a query to retrieve details of all projects whose status is
“Ongoing”.
• The global query will be
σstatus="ongoing"(PROJECT)
Pid City Department Status
1/11/2017 21Prof. Dhaval R. Chandarana
Example
• Query in New Delhi’s server will be
σstatus="ongoing"(NewD−PROJECT)
• Query in Kolkata’s server will be
σstatus="ongoing"(Kol−PROJECT)
• Query in Hyderabad’s server will be
σstatus="ongoing"(Hyd−PROJECT)
• In order to get the overall result, we need to union the results of the three
queries as follows
σstatus="ongoing"(NewD−PROJECT)∪σstatus="ongoing"(kol−PROJECT)∪σs
tatus="ongoing"(Hyd−PROJECT)
1/11/2017 22Prof. Dhaval R. Chandarana
Important Question
 Q:1 Explain Layer of Query Processing.
 Q:2 Explain Query Processing in Centralized System.
 Q:3 Explain Query Processing in Distributed System.
 Q:4 Explain Query Processing Problem.
1/11/2017 23Prof. Dhaval R. Chandarana

More Related Content

What's hot

Query Decomposition and data localization
Query Decomposition and data localization Query Decomposition and data localization
Query Decomposition and data localization Hafiz faiz
 
management of distributed transactions
management of distributed transactionsmanagement of distributed transactions
management of distributed transactionsNilu Desai
 
distributed Computing system model
distributed Computing system modeldistributed Computing system model
distributed Computing system modelHarshad Umredkar
 
Distributed dbms architectures
Distributed dbms architecturesDistributed dbms architectures
Distributed dbms architecturesPooja Dixit
 
Concurrency Control in Distributed Database.
Concurrency Control in Distributed Database.Concurrency Control in Distributed Database.
Concurrency Control in Distributed Database.Meghaj Mallick
 
Distributed database management system
Distributed database management  systemDistributed database management  system
Distributed database management systemPooja Dixit
 
Database , 8 Query Optimization
Database , 8 Query OptimizationDatabase , 8 Query Optimization
Database , 8 Query OptimizationAli Usman
 
DISTRIBUTED DATABASE WITH RECOVERY TECHNIQUES
DISTRIBUTED DATABASE WITH RECOVERY TECHNIQUESDISTRIBUTED DATABASE WITH RECOVERY TECHNIQUES
DISTRIBUTED DATABASE WITH RECOVERY TECHNIQUESAAKANKSHA JAIN
 
Distributed concurrency control
Distributed concurrency controlDistributed concurrency control
Distributed concurrency controlBinte fatima
 
distributed shared memory
 distributed shared memory distributed shared memory
distributed shared memoryAshish Kumar
 
Distributed Database System
Distributed Database SystemDistributed Database System
Distributed Database SystemSulemang
 
Ddb 1.6-design issues
Ddb 1.6-design issuesDdb 1.6-design issues
Ddb 1.6-design issuesEsar Qasmi
 
Distribution transparency and Distributed transaction
Distribution transparency and Distributed transactionDistribution transparency and Distributed transaction
Distribution transparency and Distributed transactionshraddha mane
 
13. Query Processing in DBMS
13. Query Processing in DBMS13. Query Processing in DBMS
13. Query Processing in DBMSkoolkampus
 
Distributed Database Management System
Distributed Database Management SystemDistributed Database Management System
Distributed Database Management SystemAAKANKSHA JAIN
 

What's hot (20)

Query Decomposition and data localization
Query Decomposition and data localization Query Decomposition and data localization
Query Decomposition and data localization
 
management of distributed transactions
management of distributed transactionsmanagement of distributed transactions
management of distributed transactions
 
distributed Computing system model
distributed Computing system modeldistributed Computing system model
distributed Computing system model
 
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
 
Distributed dbms architectures
Distributed dbms architecturesDistributed dbms architectures
Distributed dbms architectures
 
Concurrency Control in Distributed Database.
Concurrency Control in Distributed Database.Concurrency Control in Distributed Database.
Concurrency Control in Distributed Database.
 
Distributed database management system
Distributed database management  systemDistributed database management  system
Distributed database management system
 
Database , 8 Query Optimization
Database , 8 Query OptimizationDatabase , 8 Query Optimization
Database , 8 Query Optimization
 
Distributed DBMS - Unit 3 - Distributed DBMS Architecture
Distributed DBMS - Unit 3 - Distributed DBMS ArchitectureDistributed DBMS - Unit 3 - Distributed DBMS Architecture
Distributed DBMS - Unit 3 - Distributed DBMS Architecture
 
DISTRIBUTED DATABASE WITH RECOVERY TECHNIQUES
DISTRIBUTED DATABASE WITH RECOVERY TECHNIQUESDISTRIBUTED DATABASE WITH RECOVERY TECHNIQUES
DISTRIBUTED DATABASE WITH RECOVERY TECHNIQUES
 
Distributed concurrency control
Distributed concurrency controlDistributed concurrency control
Distributed concurrency control
 
distributed shared memory
 distributed shared memory distributed shared memory
distributed shared memory
 
Distributed Database System
Distributed Database SystemDistributed Database System
Distributed Database System
 
Query processing
Query processingQuery processing
Query processing
 
Ddb 1.6-design issues
Ddb 1.6-design issuesDdb 1.6-design issues
Ddb 1.6-design issues
 
Ddbms1
Ddbms1Ddbms1
Ddbms1
 
Distribution transparency and Distributed transaction
Distribution transparency and Distributed transactionDistribution transparency and Distributed transaction
Distribution transparency and Distributed transaction
 
13. Query Processing in DBMS
13. Query Processing in DBMS13. Query Processing in DBMS
13. Query Processing in DBMS
 
Distributed System ppt
Distributed System pptDistributed System ppt
Distributed System ppt
 
Distributed Database Management System
Distributed Database Management SystemDistributed Database Management System
Distributed Database Management System
 

Similar to Distributed DBMS - Unit 6 - Query Processing

PPT-UEU-Database-Objek-Terdistribusi-Pertemuan-8.pptx
PPT-UEU-Database-Objek-Terdistribusi-Pertemuan-8.pptxPPT-UEU-Database-Objek-Terdistribusi-Pertemuan-8.pptx
PPT-UEU-Database-Objek-Terdistribusi-Pertemuan-8.pptxneju3
 
Presentation
PresentationPresentation
PresentationAkul1501
 
Query optimization
Query optimizationQuery optimization
Query optimizationPooja Dixit
 
Phases of distributed query processing
Phases of distributed query processingPhases of distributed query processing
Phases of distributed query processingNevil Dsouza
 
07.Overview_of_Query_Processing.pdf
07.Overview_of_Query_Processing.pdf07.Overview_of_Query_Processing.pdf
07.Overview_of_Query_Processing.pdfssusera4b8a1
 
Lecture 5.pptx
Lecture 5.pptxLecture 5.pptx
Lecture 5.pptxShafii8
 
Optimized Access Strategies for a Distributed Database Design
Optimized Access Strategies for a Distributed Database DesignOptimized Access Strategies for a Distributed Database Design
Optimized Access Strategies for a Distributed Database DesignWaqas Tariq
 
Query Plan Generation using Particle Swarm Optimization
Query Plan Generation using Particle Swarm OptimizationQuery Plan Generation using Particle Swarm Optimization
Query Plan Generation using Particle Swarm OptimizationAkshay Jain
 
LECTURE_06_DATABASE PROCESSING & OPTIMAZATION.pptx
LECTURE_06_DATABASE PROCESSING & OPTIMAZATION.pptxLECTURE_06_DATABASE PROCESSING & OPTIMAZATION.pptx
LECTURE_06_DATABASE PROCESSING & OPTIMAZATION.pptxAthosBeatus
 
Welcome to International Journal of Engineering Research and Development (IJERD)
Welcome to International Journal of Engineering Research and Development (IJERD)Welcome to International Journal of Engineering Research and Development (IJERD)
Welcome to International Journal of Engineering Research and Development (IJERD)IJERD Editor
 
Performance Considerations in Logical Data Warehouse
Performance Considerations in Logical Data WarehousePerformance Considerations in Logical Data Warehouse
Performance Considerations in Logical Data WarehouseDenodo
 
An enhanced adaptive scoring job scheduling algorithm with replication strate...
An enhanced adaptive scoring job scheduling algorithm with replication strate...An enhanced adaptive scoring job scheduling algorithm with replication strate...
An enhanced adaptive scoring job scheduling algorithm with replication strate...eSAT Publishing House
 

Similar to Distributed DBMS - Unit 6 - Query Processing (20)

PPT-UEU-Database-Objek-Terdistribusi-Pertemuan-8.pptx
PPT-UEU-Database-Objek-Terdistribusi-Pertemuan-8.pptxPPT-UEU-Database-Objek-Terdistribusi-Pertemuan-8.pptx
PPT-UEU-Database-Objek-Terdistribusi-Pertemuan-8.pptx
 
Presentation
PresentationPresentation
Presentation
 
Mc seminar
Mc seminarMc seminar
Mc seminar
 
Query optimization
Query optimizationQuery optimization
Query optimization
 
Phases of distributed query processing
Phases of distributed query processingPhases of distributed query processing
Phases of distributed query processing
 
07.Overview_of_Query_Processing.pdf
07.Overview_of_Query_Processing.pdf07.Overview_of_Query_Processing.pdf
07.Overview_of_Query_Processing.pdf
 
Lecture 5.pptx
Lecture 5.pptxLecture 5.pptx
Lecture 5.pptx
 
Query optimization
Query optimizationQuery optimization
Query optimization
 
Optimized Access Strategies for a Distributed Database Design
Optimized Access Strategies for a Distributed Database DesignOptimized Access Strategies for a Distributed Database Design
Optimized Access Strategies for a Distributed Database Design
 
Measures of query cost
Measures of query costMeasures of query cost
Measures of query cost
 
Query Plan Generation using Particle Swarm Optimization
Query Plan Generation using Particle Swarm OptimizationQuery Plan Generation using Particle Swarm Optimization
Query Plan Generation using Particle Swarm Optimization
 
LECTURE_06_DATABASE PROCESSING & OPTIMAZATION.pptx
LECTURE_06_DATABASE PROCESSING & OPTIMAZATION.pptxLECTURE_06_DATABASE PROCESSING & OPTIMAZATION.pptx
LECTURE_06_DATABASE PROCESSING & OPTIMAZATION.pptx
 
DIET_BLAST
DIET_BLASTDIET_BLAST
DIET_BLAST
 
Welcome to International Journal of Engineering Research and Development (IJERD)
Welcome to International Journal of Engineering Research and Development (IJERD)Welcome to International Journal of Engineering Research and Development (IJERD)
Welcome to International Journal of Engineering Research and Development (IJERD)
 
Manjeet Singh.pptx
Manjeet Singh.pptxManjeet Singh.pptx
Manjeet Singh.pptx
 
Query processing
Query processingQuery processing
Query processing
 
Performance Considerations in Logical Data Warehouse
Performance Considerations in Logical Data WarehousePerformance Considerations in Logical Data Warehouse
Performance Considerations in Logical Data Warehouse
 
An enhanced adaptive scoring job scheduling algorithm with replication strate...
An enhanced adaptive scoring job scheduling algorithm with replication strate...An enhanced adaptive scoring job scheduling algorithm with replication strate...
An enhanced adaptive scoring job scheduling algorithm with replication strate...
 
Query trees
Query treesQuery trees
Query trees
 
Dremel Paper Review
Dremel Paper ReviewDremel Paper Review
Dremel Paper Review
 

More from Gyanmanjari Institute Of Technology

More from Gyanmanjari Institute Of Technology (20)

WD - Unit - 7 - Advanced Concepts
WD - Unit - 7 - Advanced ConceptsWD - Unit - 7 - Advanced Concepts
WD - Unit - 7 - Advanced Concepts
 
WD - Unit - 4 - PHP Basics
WD - Unit - 4 - PHP BasicsWD - Unit - 4 - PHP Basics
WD - Unit - 4 - PHP Basics
 
WD - Unit - 3 - Java Script
WD - Unit - 3 - Java ScriptWD - Unit - 3 - Java Script
WD - Unit - 3 - Java Script
 
WD - Unit - 6 - Database Connectivity using PHP
WD - Unit - 6 - Database Connectivity using PHPWD - Unit - 6 - Database Connectivity using PHP
WD - Unit - 6 - Database Connectivity using PHP
 
WD - Unit - 5 - Session and State Management using PHP
WD - Unit - 5 - Session and State Management using PHPWD - Unit - 5 - Session and State Management using PHP
WD - Unit - 5 - Session and State Management using PHP
 
WD - Unit - 2 - HTML & CSS
WD - Unit - 2 - HTML & CSSWD - Unit - 2 - HTML & CSS
WD - Unit - 2 - HTML & CSS
 
WD - Unit - 1 - Introduction
WD - Unit - 1 - IntroductionWD - Unit - 1 - Introduction
WD - Unit - 1 - Introduction
 
OSV - Unit - 8 - Unix/Linux Operating System
OSV - Unit - 8 - Unix/Linux Operating SystemOSV - Unit - 8 - Unix/Linux Operating System
OSV - Unit - 8 - Unix/Linux Operating System
 
OSV - Unit - 10 - Approaches to Virtualization
OSV - Unit - 10 - Approaches to VirtualizationOSV - Unit - 10 - Approaches to Virtualization
OSV - Unit - 10 - Approaches to Virtualization
 
OSV - Unit - 9 - Virtualization Concepts
OSV - Unit - 9 - Virtualization ConceptsOSV - Unit - 9 - Virtualization Concepts
OSV - Unit - 9 - Virtualization Concepts
 
OSV - Unit - 7 - I/O Management & Disk scheduling
OSV - Unit - 7 - I/O Management & Disk schedulingOSV - Unit - 7 - I/O Management & Disk scheduling
OSV - Unit - 7 - I/O Management & Disk scheduling
 
OSV - Unit - 6 - Memory Management
OSV - Unit - 6 - Memory ManagementOSV - Unit - 6 - Memory Management
OSV - Unit - 6 - Memory Management
 
CNS - Unit - 10 - Web Security Threats and Approaches
CNS - Unit - 10 - Web Security Threats and ApproachesCNS - Unit - 10 - Web Security Threats and Approaches
CNS - Unit - 10 - Web Security Threats and Approaches
 
OSV - Unit - 5 - Deadlock
OSV - Unit - 5 - DeadlockOSV - Unit - 5 - Deadlock
OSV - Unit - 5 - Deadlock
 
OSV - Unit - 4 - Inter Process Communication
OSV - Unit - 4 - Inter Process CommunicationOSV - Unit - 4 - Inter Process Communication
OSV - Unit - 4 - Inter Process Communication
 
OSV - Unit - 3 - Concurrency
OSV - Unit - 3 - ConcurrencyOSV - Unit - 3 - Concurrency
OSV - Unit - 3 - Concurrency
 
OSV - Unit - 2 - Process and Threads Management
OSV - Unit - 2 - Process and Threads ManagementOSV - Unit - 2 - Process and Threads Management
OSV - Unit - 2 - Process and Threads Management
 
CNS - Unit - 8 - Key Management and Distribution
CNS - Unit - 8 - Key Management and DistributionCNS - Unit - 8 - Key Management and Distribution
CNS - Unit - 8 - Key Management and Distribution
 
CNS - Unit - 7 - Digital Signature
CNS - Unit - 7 - Digital SignatureCNS - Unit - 7 - Digital Signature
CNS - Unit - 7 - Digital Signature
 
CNS - Unit - 6 - Message Authentication Code
CNS - Unit - 6 - Message Authentication CodeCNS - Unit - 6 - Message Authentication Code
CNS - Unit - 6 - Message Authentication Code
 

Recently uploaded

Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile servicerehmti665
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...Soham Mondal
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxwendy cai
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxJoão Esperancinha
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)Suman Mia
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidNikhilNagaraju
 
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxthe ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxhumanexperienceaaa
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSRajkumarAkumalla
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxupamatechverse
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...ranjana rawat
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Dr.Costas Sachpazis
 
chaitra-1.pptx fake news detection using machine learning
chaitra-1.pptx  fake news detection using machine learningchaitra-1.pptx  fake news detection using machine learning
chaitra-1.pptx fake news detection using machine learningmisbanausheenparvam
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations120cr0395
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxupamatechverse
 

Recently uploaded (20)

Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile service
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptx
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfid
 
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxthe ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptx
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
chaitra-1.pptx fake news detection using machine learning
chaitra-1.pptx  fake news detection using machine learningchaitra-1.pptx  fake news detection using machine learning
chaitra-1.pptx fake news detection using machine learning
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINEDJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptx
 

Distributed DBMS - Unit 6 - Query Processing

  • 2. Outlines… • Introduction of Query Processing • Query Processing Problem • Layer of Query Processing • Query Processing in Centralized Systems • Query Processing in Distributed Systems 1/11/2017 2Prof. Dhaval R. Chandarana
  • 3. Introduction of Query Processing • Query processing in a distributed context is to transform a high-level query on a distributed database, which is seen as a single database by the users, into an efficient execution strategy expressed in a low-level language on local databases. • The main function of a relational query processor is to transform a high-level query (typically, in relational calculus) into an equivalent lower-level query (typically, in some variation of relational algebra). 1/11/2017 3Prof. Dhaval R. Chandarana
  • 4. Query Processing Problem • The main difficulty is to select the execution strategy that minimizes resource consumption. • The low-level query actually implements the execution strategy for the query. The transformation must achieve both correctness and efficiency. • It is correct if the low-level query has the same semantics as the original query, that is, if both queries produce the same result. • The well-defined mapping from relational calculus to relational algebra makes the correctness issue easy. 1/11/2017 4Prof. Dhaval R. Chandarana
  • 5. Query Processing Example • Example: Transformation of an SQL-query into an RA-query. Relations: EMP(ENO, ENAME, TITLE), ASG(ENO,PNO,RESP,DUR) Query: Find the names of employees who are managing a project? – High level query SELECT ENAME FROM EMP,ASG WHERE EMP.ENO = ASG.ENO AND DUR > 37 – Two possible transformations of the query are: • Expression 1: ENAME(DUR>37∧EMP.ENO=ASG.ENO(EMP × ASG)) • Expression 2: ENAME(EMP ⋊⋉ENO (DUR>37(ASG))) – Expression 2 avoids the expensive and large intermediate Cartesian product, and therefore typically is better. 1/11/2017 5Prof. Dhaval R. Chandarana
  • 6. Query Processing Example • We make the following assumptions about the data fragmentation – Data is (horizontally) fragmented: • Site1: ASG1 = ENO≤”E3”(ASG) • Site2: ASG2 = ENO>”E3”(ASG) • Site3: EMP1 = ENO≤”E3”(EMP) • Site4: EMP2 = ENO>”E3”(EMP) • Site5: Result • Relations ASG and EMP are fragmented in the same way • Relations ASG and EMP are locally clustered on attributes RESP and ENO, • respectively 1/11/2017 6Prof. Dhaval R. Chandarana
  • 7. 1/11/2017 7Prof. Dhaval R. Chandarana
  • 8. 1/11/2017 8Prof. Dhaval R. Chandarana
  • 10. Query Decomposition • The first layer decomposes the calculus query into an algebraic query on global relations. The information needed for this transformation is found in the global conceptual schema describing the global relations. • Query decomposition can be viewed as four successive steps. • First, the calculus query is rewritten in a normalized form that is suitable for subsequent manipulation. Normalization of a query generally involves the manipulation of the query quantifiers and of the query qualification by applying logical operator priority. • Second, the normalized query is analyzed semantically so that incorrect queries are detected and rejected as early as possible. Techniques to detect incorrect queries exist only for a subset of relational calculus. Typically, they use some sort of graph that captures the semantics of the query. 1/11/2017 10Prof. Dhaval R. Chandarana
  • 11. Query Decomposition • Third, the correct query (still expressed in relational calculus) is simplified. One way to simplify a query is to eliminate redundant predicates. Note that redundant queries are likely to arise when a query is the result of system transformations applied to the user query. such transformations are used for performing semantic data control (views, protection, and semantic integrity control). • Fourth, the calculus query is restructured as an algebraic query. The traditional way to do this transformation toward a “better” algebraic specification is to start with an initial algebraic query and transform it in order to find a “go • The algebraic query generated by this layer is good in the sense that the worse executions are typically avoided. 1/11/2017 11Prof. Dhaval R. Chandarana
  • 12. Data Localization • The input to the second layer is an algebraic query on global relations. The main role of the second layer is to localize the query’s data using data distribution information in the fragment schema. • This layer determines which fragments are involved in the query and transforms the distributed query into a query on fragments. • A global relation can be reconstructed by applying the fragmentation rules, and then deriving a program, called a localization program, of relational algebra operators, which then act on fragments. • Generating a query on fragments is done in two steps • First, the query is mapped into a fragment query by substituting each relation by its reconstruction program (also called materialization program). • Second, the fragment query is simplified and restructured to produce another “good” query. 1/11/2017 12Prof. Dhaval R. Chandarana
  • 13. Global Query Optimization • The input to the third layer is an algebraic query on fragments. The goal of query optimization is to find an execution strategy for the query which is close to optimal. • The previous layers have already optimized the query, for example, by eliminating redundant expressions. However, this optimization is independent of fragment characteristics such as fragment allocation and cardinalities. • Query optimization consists of finding the “best” ordering of operators in the query, including communication operators that minimize a cost function. • The output of the query optimization layer is a optimized algebraic query with communication operators included on fragments. It is typically represented and saved (for future executions) as a distributed query execution plan . 1/11/2017 13Prof. Dhaval R. Chandarana
  • 14. Distributed Query Execution • The last layer is performed by all the sites having fragments involved in the query. • Each sub query executing at one site, called a local query, is then optimized using the local schema of the site and executed. 1/11/2017 14Prof. Dhaval R. Chandarana
  • 15. Characterization of Query Processors • The input language to the query processor can be based on relational calculus or relational algebra. • Query optimization is to select a best point of solution space that leads to the minimum cost. • Optimization can be done statically before executing the query or dynamically as the query is executed. • Dynamic query optimization requires statistics in order to choose the operation that has to be done first. • Static query optimization requires statistics to estimate the size of intermediate relations. • Distributed query processor exploits the network topology. 1/11/2017 15Prof. Dhaval R. Chandarana
  • 16. Query Processing in Centralized Systems • Goal of query processor in centralized system is: 1. Minimize the query response time. 2. Maximize the parallelism in the system 3. Maximize the system throughput. • In centralized DBMS query processing consists of four steps: 1. Query decomposition 2. Query optimization 3. Code generation 4. Query execution 1/11/2017 16Prof. Dhaval R. Chandarana
  • 17. Query Processing in Centralized Systems Query Decomposing Query Optimization Code generation Runtime query execution Output SQL Query System catalog Database statistics Main Database 1/11/2017 17Prof. Dhaval R. Chandarana
  • 18. Query Processing in Distributed Systems • In a distributed DBMS the catalog has to store additional information including the location of relations and their replicas. The catalog must also include system wise information such as the number of site in the system along with their identifiers'. 1/11/2017 18Prof. Dhaval R. Chandarana
  • 19. Mapping Global Query to Local • The tables required in a global query have fragments distributed across multiple sites. The local databases have information only about local data. The controlling site uses the global data dictionary to gather information about the distribution and reconstructs the global view from the fragments. • If there is no replication, the global optimizer runs local queries at the sites where the fragments are stored. If there is replication, the global optimizer selects the site based upon communication cost, workload, and server speed. 1/11/2017 19Prof. Dhaval R. Chandarana
  • 20. Mapping Global Query to Local • The global optimizer generates a distributed execution plan so that least amount of data transfer occurs across the sites. The plan states the location of the fragments, order in which query steps needs to be executed and the processes involved in transferring intermediate results. • The local queries are optimized by the local database servers. Finally, the local query results are merged together through union operation in case of horizontal fragments and join operation for vertical fragments. 1/11/2017 20Prof. Dhaval R. Chandarana
  • 21. Example • For example, let us consider that the following Project schema is horizontally fragmented according to City, the cities being New Delhi, Kolkata and Hyderabad. • PROJECT • Suppose there is a query to retrieve details of all projects whose status is “Ongoing”. • The global query will be σstatus="ongoing"(PROJECT) Pid City Department Status 1/11/2017 21Prof. Dhaval R. Chandarana
  • 22. Example • Query in New Delhi’s server will be σstatus="ongoing"(NewD−PROJECT) • Query in Kolkata’s server will be σstatus="ongoing"(Kol−PROJECT) • Query in Hyderabad’s server will be σstatus="ongoing"(Hyd−PROJECT) • In order to get the overall result, we need to union the results of the three queries as follows σstatus="ongoing"(NewD−PROJECT)∪σstatus="ongoing"(kol−PROJECT)∪σs tatus="ongoing"(Hyd−PROJECT) 1/11/2017 22Prof. Dhaval R. Chandarana
  • 23. Important Question  Q:1 Explain Layer of Query Processing.  Q:2 Explain Query Processing in Centralized System.  Q:3 Explain Query Processing in Distributed System.  Q:4 Explain Query Processing Problem. 1/11/2017 23Prof. Dhaval R. Chandarana