Parallel Algorithms for Relational Operations. Many processors...and disks There is a collection of processors. –Often the number of processors p is large,

Slides:



Advertisements
Similar presentations
CS4432: Database Systems II
Advertisements

CS 245Notes 71 CS 245: Database System Principles Notes 7: Query Optimization Hector Garcia-Molina.
CS 4432query processing - lecture 161 CS4432: Database Systems II Lecture #16 Join Processing Algorithms Professor Elke A. Rundensteiner.
1 Lecture 23: Query Execution Friday, March 4, 2005.
Join Processing in Databases Systems with Large Main Memories
15.8 Algorithms using more than two passes Presented By: Seungbeom Ma (ID 125) Professor: Dr. T. Y. Lin Computer Science Department San Jose State University.
CS CS4432: Database Systems II Operator Algorithms Chapter 15.
Bhargav Vadher (208) APRIL 9 th, 2008 Submittetd To: Dr. T Y Lin Computer Science Department San Jose State University.
Dr. Kalpakis CMSC 661, Principles of Database Systems Query Execution [15]
Completing the Physical-Query-Plan. Query compiler so far Parsed the query. Converted it to an initial logical query plan. Improved that logical query.
Notions of clustering Clustered relation: tuples are stored in blocks mostly devoted to that relation. Clustering index: tuples (of the relation) with.
Greedy Algo. for Selecting a Join Order The "greediness" is based on the idea that we want to keep the intermediate relations as small as possible at each.
Nested-Loop joins “one-and-a-half” pass method, since one relation will be read just once. Tuple-Based Nested-loop Join Algorithm: FOR each tuple s in.
15.3 Nested-Loop Joins By: Saloni Tamotia (215). Introduction to Nested-Loop Joins  Used for relations of any side.  Not necessary that relation fits.
Notions of clustering Clustered file: e.g. store movie tuples together with the corresponding studio tuple. Clustered relation: tuples are stored in blocks.
CS 245Notes 71 CS 245: Database System Principles Notes 7: Query Optimization Hector Garcia-Molina.
15.6 Index-based Algorithms Jindou Jiao 101. Index-based algorithms are especially useful for the selection operator Algorithms for join and other binary.
Lecture 24: Query Execution Monday, November 20, 2000.
Parallel Algorithms for Relational Operations. Models of Parallelism There is a collection of processors. –Often the number of processors p is large,
Query Execution 15.5 Two-pass Algorithms based on Hashing By Swathi Vegesna.
1 Lecture 22: Query Execution Wednesday, March 2, 2005.
Nested Loops Joins Book Section of chapter 15.3 Submitted to : Prof. Dr. T.Y. LIN Submitted by: Saurabh Vishal.
15.5 Two-Pass Algorithms Based on Hashing 115 ChenKuang Yang.
Query Execution :Nested-Loop Joins Rohit Deshmukh ID 120 CS-257 Rohit Deshmukh ID 120 CS-257.
Distributed Databases and Query Processing. Distributed DB’s vs. Parallel DB’s Many autonomous processors that may participate in database operations.
Query Compiler: 16.7 Completing the Physical Query-Plan CS257 Spring 2009 Professor Tsau Lin Student: Suntorn Sae-Eung ID: 212.
Parallel Algorithms for Relational Operations Class ID: 21 Name: Shujia Zhang.
Sorting and Query Processing Zachary G. Ives University of Pennsylvania CIS 550 – Database & Information Systems November 29, 2005.
Chapter 15.7 Buffer Management ID: 219 Name: Qun Yu Class: CS Spring 2009 Instructor: Dr. T.Y.Lin.
1 Relational Operators. 2 Outline Logical/physical operators Cost parameters and sorting One-pass algorithms Nested-loop joins Two-pass algorithms.
CSCE Database Systems Chapter 15: Query Execution 1.
Query Execution Section 15.1 Shweta Athalye CS257: Database Systems ID: 118 Section 1.
CS4432: Database Systems II Query Processing- Part 3 1.
CS411 Database Systems Kazuhiro Minami 11: Query Execution.
16.7 Completing the Physical- Query-Plan By Aniket Mulye CS257 Prof: Dr. T. Y. Lin.
Lecture 24 Query Execution Monday, November 28, 2005.
Multi pass algorithms. Nested-Loop joins Tuple-Based Nested-loop Join Algorithm: FOR each tuple s in S DO FOR each tuple r in R DO IF r and s join to.
CS4432: Database Systems II Query Processing- Part 2.
CSCE Database Systems Chapter 15: Query Execution 1.
©Silberschatz, Korth and Sudarshan18.1Database System Concepts - 6 th Edition Chapter 18: Parallel Databases Introduction I/O Parallelism Interquery Parallelism.
©Silberschatz, Korth and Sudarshan20.1Database System Concepts 3 rd Edition Chapter 20: Parallel Databases Introduction I/O Parallelism Interquery Parallelism.
Lecture 17: Query Execution Tuesday, February 28, 2001.
CS 440 Database Management Systems Lecture 5: Query Processing 1.
CS 540 Database Management Systems
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Evaluation of Relational Operations Chapter 14, Part A (Joins)
1 Lecture 23: Query Execution Monday, November 26, 2001.
1 Overview of Query Evaluation Chapter Outline  Query Optimization Overview  Algorithm for Relational Operations.
Two-Pass Algorithms Based on Sorting
15.1 – Introduction to physical-Query-plan operators
CS 540 Database Management Systems
CS 440 Database Management Systems
Query Processing Exercise Session 4.
Parallel Databases.
Database Management System
Chapter 15 QUERY EXECUTION.
15.5 Two-Pass Algorithms Based on Hashing
Database Systems Ch Michael Symonds
Yan Huang - CSCI5330 Database Implementation – Access Methods
Sidharth Mishra Dr. T.Y. Lin CS 257 Section 1 MH 222 SJSU - Fall 2016
Query Execution Two-pass Algorithms based on Hashing
(Two-Pass Algorithms)
Chapters 15 and 16b: Query Optimization
One-Pass Algorithms for Database Operations (15.2)
Lecture 23: Query Execution
Sorting We may build an index on the relation, and then use the index to read the relation in sorted order. May lead to one disk block access for each.
CPSC-608 Database Systems
Lecture 22: Query Execution
CPSC-608 Database Systems
Lecture 24: Query Execution
Lecture 20: Query Execution
Presentation transcript:

Parallel Algorithms for Relational Operations

Many processors...and disks There is a collection of processors. –Often the number of processors p is large, in the hundreds or thousands. Of great importance to database processing is the fact that along with these processors are many disks, perhaps one or more per processor.

Shared Nothing Architecture This architecture is the most commonly used for DB operations.

 C (R) in parallel Distribute data across as many disks as possible. –Use some hash function h. –Then if there are p processors, divide relation R's tuples among the p processor's disks. Each processor examines tuples of R present on its own disk. –The result,  C (R), is divided among the processors, just like R is. Be careful about which attributes to use for distributing data. –E.g. if  a=10 (R), don't use a.

Joins R(X,Y)  S(Y,Z) Hash tuples of R and S using the same hash function on Y and distribute them among the p processors. We need B(R) + B(S) I/O’s for this. Then we must ship ((p-1)/p)*(B(R)+B(S)) data across network. Cost of shipment We will assume that shipment across the network is significantly cheaper than movement of data between disk and memory, because no physical motion is involved in shipment across a network, while it is for disk I/O.

Joins Each receiving processor has to store the data on its own disk, then execute a local join on the tuples received. –Sizes of relations that each processor receives are B(R)/p and B(S)/p approximately. –If we used a two-pass sort-join at each processor, we would do 3(B(R) + B(S))/p disk I/O's at each processor. Add another 2(B(R) + B(S))/p disk I/O's per processor, to account for: –first read of each tuple during hashing and distribution and –storing away of each tuple by the processor receiving the tuple during hash and distribution. More I/O's in total - 5 I/O's per block of data, rather than 3. However, the elapsed time, as measured by the number of I/O's performed at each processor has gone down from 3(B(R) + B(S)) to 5(B(R) + B(S))/p ---- significant win for large p.

We can do even better - Example B(R) = 1000 blocks, B(S) = 500 blocks, M = 101 buffers per processor 10 processors We begin by hashing each tuple of R and S to one of 10 "buckets," using a hash function h that depends only on the join attributes Y. These 10 "buckets" represent the 10 processors, and tuples are shipped to the processor corresponding to their "bucket.“ The total number of disk I/O's needed to read the tuples of R and S is 1500, or 150 per processor.

Example Each processor will have about 15 blocks worth of data for each other processor, so it ships 135 blocks to the other nine processors. We arrange that the processors ship the tuples of S before the tuples of R. Since each processor receives about 50 blocks of tuples from S, it can store those tuples in a main-memory data structure, using 50 of its 101 buffers. Then, when processors start sending R-tuples, each one is compared with the local S-tuples, and any resulting joined tuples are output. In this way, the only cost of the join is 1500 disk I/O's, much less than for any other method discussed.

Example Moreover, the elapsed time is primarily the 150 disk I/O's performed at each processor, plus the time to ship tuples between processors and perform the main-memory computations. Note that 150 disk I/O's is less than 1/10 th of the time to perform the same algorithm on a uniprocessor; –we have not only gained because we had 10 processors working for us, but the fact that there are a total of 1010 buffers among those 10 processors gives us additional efficiency.