Parallel DBMS Chapter 22, Sections 22.1–22.6

Slides:



Advertisements
Similar presentations
Unit 1:Parallel Databases
Advertisements

Database Management Systems, R. Ramakrishnan and J. Gehrke1 Evaluation of Relational Operations Chapter 12, Part A.
Equality Join R X R.A=S.B S : : Relation R M PagesN Pages Relation S Pr records per page Ps records per page.
CS 245Notes 71 CS 245: Database System Principles Notes 7: Query Optimization Hector Garcia-Molina.
Query Execution, Concluded Zachary G. Ives University of Pennsylvania CIS 550 – Database & Information Systems November 18, 2003 Some slide content may.
Parallel Databases By Dr.S.Sridhar, Ph.D.(JNUD), RACI(Paris, NICE), RMR(USA), RZFM(Germany) DIRECTOR ARUNAI ENGINEERING COLLEGE TIRUVANNAMALAI.
Database Management Systems, 2 nd Edition. Raghu Ramakrishnan and Johannes Gehrke1 Parallel Database Systems Taken/tweaked from the Wisconsin DB book slides.
Parallel Database Systems
Parallel Database Systems The Future Of High Performance Database Systems David Dewitt and Jim Gray 1992 Presented By – Ajith Karimpana.
Parallel DBMS Slides adapted from textbook; from Joe Hellerstein; and from Jim Gray, Microsoft Research. DBMS Textbook Chapter 22.
Parallel DBMS Chapter 22, Part A
Query Optimization 3 Cost Estimation R&G, Chapters 12, 13, 14 Lecture 15.
Introduction to Database Systems 1 Join Algorithms Query Processing: Lecture 1.
1 Parallel DBMS Slides by Joe Hellerstein, UCB, with some material from Jim Gray, Microsoft Research. See also:
Evaluation of Relational Operations. Relational Operations v We will consider how to implement: – Selection ( ) Selects a subset of rows from relation.
Parallel DBMS Instructor : Marina Gavrilova
Physical Database Design & Performance. Optimizing for Query Performance For DBs with high retrieval traffic as compared to maintenance traffic, optimizing.
Querying Large Databases Rukmini Kaushik. Purpose Research for efficient algorithms and software architectures of query engines.
Relational Operator Evaluation. Overview Index Nested Loops Join If there is an index on the join column of one relation (say S), can make it the inner.
Parallel Database Systems Instructor: Dr. Yingshu Li Student: Chunyu Ai.
Chapter 12 Query Processing (1) Yonsei University 2 nd Semester, 2013 Sanghyun Park.
Lecture 15- Parallel Databases (continued) Advanced Databases Masood Niazi Torshiz Islamic Azad University- Mashhad Branch
CPSC 404, Laks V.S. Lakshmanan1 Evaluation of Relational Operations – Join Chapter 14 Ramakrishnan and Gehrke (Section 14.4)
Lecture 14- Parallel Databases Advanced Databases Masood Niazi Torshiz Islamic Azad University- Mashhad Branch
©Silberschatz, Korth and Sudarshan20.1Database System Concepts 3 rd Edition Chapter 20: Parallel Databases Introduction I/O Parallelism Interquery Parallelism.
CS 440 Database Management Systems Lecture 5: Query Processing 1.
Computing & Information Sciences Kansas State University Wednesday, 08 Nov 2006CIS 560: Database System Concepts Lecture 32 of 42 Monday, 06 November 2006.
Relational Operator Evaluation. overview Projection Two steps –Remove unwanted attributes –Eliminate any duplicate tuples The expensive part is removing.
Implementation of Database Systems, Jarek Gryz1 Evaluation of Relational Operations Chapter 12, Part A.
Implementation of Database Systems, Jarek Gryz 1 Parallel DBMS Chapter 22, Part A.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Evaluation of Relational Operations Chapter 14, Part A (Joins)
CPT-S Advanced Databases 11 Yinghui Wu EME 49.
Database System Architectures Centralized Systems Client-Server Systems Transaction Servers Data Servers Parallel DBMS Interconnection Network Architectures.
CS 540 Database Management Systems
CS 540 Database Management Systems
CS 440 Database Management Systems
Parallel Databases.
Database Management System
Tree-Structured Indexes
Database Applications (15-415) DBMS Internals- Part VII Lecture 16, October 25, 2016 Mohammad Hammoud.
Interquery Parallelism
Database Performance Tuning and Query Optimization
Introduction to Query Optimization
Evaluation of Relational Operations
Chapter 15 QUERY EXECUTION.
Database Management Systems (CS 564)
Evaluation of Relational Operations: Other Operations
April 30th – Scheduling / parallel
Database Applications (15-415) DBMS Internals- Part VII Lecture 19, March 27, 2018 Mohammad Hammoud.
Database Applications (15-415) DBMS Internals- Part VI Lecture 15, Oct 23, 2016 Mohammad Hammoud.
External Sorting The slides for this text are organized into chapters. This lecture covers Chapter 11. Chapter 1: Introduction to Database Systems Chapter.
Akshay Tomar Prateek Singh Lohchubh
CS222: Principles of Data Management Notes #12 Joins!
Selected Topics: External Sorting, Join Algorithms, …
Introduction to Teradata
Lecture 2- Query Processing (continued)
Parallel DBMS Chapter 22, Part A
One-Pass Algorithms for Database Operations (15.2)
Chapter 12 Query Processing (1)
Chapter 18: Parallel Databases
Chapter 11 Database Performance Tuning and Query Optimization
Evaluation of Relational Operations: Other Techniques
Overview of Query Evaluation: JOINS
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.
External Sorting Sorting is used in implementing many relational operations Problem: Relations are typically large, do not fit in main memory So cannot.
The Gamma Database Machine Project
Evaluation of Relational Operations: Other Techniques
CS222/CS122C: Principles of Data Management UCI, Fall Notes #11 Join!
Parallel DBMS DBMS Textbook Chapter 22
CS222P: Principles of Data Management UCI, Fall 2018 Notes #11 Join!
Presentation transcript:

Parallel DBMS Chapter 22, Sections 22.1–22.6 The slides for this text are organized into chapters. This lecture covers the material on parallel databases from Chapter 22. The material on distributed databases can be found in Chapter 22, Part B. Slides by Joe Hellerstein, UCB, with some material from Jim Gray, Microsoft Research, and some modifications of mine. See also: http://www.research.microsoft.com/research/BARC/Gray/PDB95.ppt

Why Parallel Access To Data? At 10 MB/s 1.2 days to scan 1,000 x parallel 1.5 minute to scan. 1 Terabyte 1 Terabyte Bandwidth 10 MB/s Parallelism: divide a big problem into many smaller ones to be solved in parallel. 56

Parallel DBMS: Introduction Centralized DBMSs assume that Processing of individual transactions is sequential Control and/or data are maintained at one single site These assumptions have been relaxed in recent decades: Parallel DBMSs: Use of parallel evaluation techniques; parallelization of various operations such as data loading, index construction, and query evaluations. Data may still be centralized; distribution dictated solely by performance considerations Distributed DBMSs: Use of both control and data distribution; data and control are dispersed and stored across several sites Data distribution also dictated by considerations of increased availability and local ownership 55

Architectures for Parallel Databases Shared Memory (SMP) Shared Disk Shared Nothing (network) CLIENTS Memory Processors Easy to program Expensive to build Difficult to scaleup Hard to program Cheap to build Easy to scaleup Sequent, SGI, Sun VMScluster, Sysplex Tandem, Teradata, SP2 101

Some Parallelism Terminology Ideal Speed-Up For a given amount of data, more resources (CPUs) means proportionally more transactions processed per second. Scale-Up with DB size If resources increased in proportion to increase in data size, # of trans./sec. remains constant. # of trans./sec. (throughput) # of CPUs Ideal # of trans./sec. (throughput) # of CPUS, DB size

Some Parallelism Terminology Scale-Up If resources increased in proportion to increase in # of trans./sec., response time remains constant. Ideal # of sec./Trans. (response time) # of CPUS, # trans./sec.

What Systems Work Which Way ? (as of 9/1995) Shared Nothing Teradata: 400 nodes Tandem: 110 nodes IBM / SP2 / DB2: 128 nodes Informix/SP2 48 nodes ATT & Sybase ? nodes Shared Disk Oracle 170 nodes DEC Rdb 24 nodes Shared Memory Informix 9 nodes RedBrick ? nodes 102

Different Types of DBMS Parallelisms Intra-operator parallelism get all machines working to compute a given operation (scan, sort, join) Inter-operator parallelism each operator may run concurrently on a different site (exploits pipelining) Inter-query parallelism different queries run on different sites We’ll focus on intra-operator parallelism

Automatic Data Partitioning Partitioning a table: Range Hash Round Robin A...E F...J K...N O...S T...Z A...E F...J K...N O...S T...Z A...E F...J K...N O...S T...Z Good for equijoins, range queries, Selections, group-by Good for equijoins Good to spread load Shared disk and memory less sensitive to partitioning, Shared nothing benefits from "good" partitioning 77

Parallelizing Existing Code for Evaluating a Relational Operator How to readily parallelize existing code to enable sequential evaluation of a relational operator? Idea: use parallel data streams Details: MERGE streams from different disks or the output of other operators to provide input streams for an operator SPLIT output of an operator to parallelize subsequent processing A parallel evaluation plan is a dataflow network of relational, merge, and split operators. Merge and split should have buffering capabilities They should regulate the output of relational operators

Parallel Scanning and Bulk Loading Pages of a relation are read in parallel, and, if the relation is partitioned across many disks, retrieved tuples are merged. Selection of tuples matching some condition may not require all sites if range or hash partitioning is used. Bulk loading: Indexes can be built at each partition. Sorting of data entries required for building the indexes during bulk loading can be done in parallel.

Parallel Sorting Simple idea: Better idea: Let each CPU sorts the portion of the relation located on its local disk; then, merge the sorted sets of tuples Better idea: First scan in parallel and redistribute the relation by range-partitioning all tuples; then each processor sorts its tuples: The CPU collects tuples until memory is full It sorts the in-memory tuples and writes out a run, until all incoming tuples have been written to sorted runs on disk The runs on disk are then merged to get the sorted version of the portion of the relation assigned to the CPU Retrieve the entire sorted relation by visiting the CPUs in the range-order to scan the tuples. Problem: how to avoid skew in range-partition! Solution: “sample” the data at start and sort the sample to determine partition points (splitting vector).

Parallel Joins: Range-Partition Assumptions: A and B are initially distributed across many processors, and k processors are availoable. Algorithm to join relations A and B on attribute age: At each processor where there are subsets of A and/or B, divide the range of age into k disjoint subranges and place partition A and B tuples into partitions corresponding to the subranges. Assign each partition to a processor to carry out a local join. Each processor joins the A and B tuples assigned to it. Tuples scanned from each processor are split, with a split operator, into output streams, depending on how many processors are available for parallel joins. Each join process receives input streams of A and B tuples from several processors, with merge operators merging all inputs streams from A and B, respectively.

Parallel Joins: Hash-Partitions Algorithm for hash-partition: Step 1 on previous slide changes to: At each processor where there are subsets of A and/or B, all local tuples are retrieved and hashed on the age attribute into k disjoint partitions, with the same hash function h used at all sites. Using range partitioning leads to a parallel version of Sort-Merge Join. Using hash partitioning leads to a parallel version of Hash Join.

Parallel Hash Join Original Relations (R then S) OUTPUT 2 B main memory buffers Disk INPUT 1 hash function h B-1 Partitions . . . Phase 1 In first phase, partitions get distributed to different sites: A good hash function automatically distributes work evenly! Do second phase at each site. Almost always the winner for equi-join.

Dataflow Network for Parallel Join Good use of split/merge makes it easier to build parallel versions of sequential join code.

Improved Parallel Hash Join Assumptions: A and B are very large, which leads to the size of each partition still being too large, which in turns leads to high local cost for processing the “smaller” joins. k partitions, n processors and k=n. Idea: Execute all smaller joins of Ai and Bi, i=1,…,k, one after the other, with each join executed in parallel using all processors.

Improved Parallel Hash Join (Cont’d) Algorithm: At each processor, apply hash function h1 to partition A and B into partitions i=1,…,k . Suppose |A|<|B|. Then choose k such sum of all k partitions of A fits into aggregate memory of all n processors. For i=1,…,k , process join of i-th partitions of A and B by doing this at every site: Apply 2nd hash function h2 to all Ai tuples to determine where they should be joined send t to site h2(t). Add in-coming Ai tuples to an in-memory hash table. Apply h2 to all Bi tuples to determine where they should be joined send t to site h2(t). Probe the in-memory hash table with in-coming Bi tuples.

Parallel Query Optimization Complex Queries: Inter-Operator parallelism Pipelining between operators: note that sort and phase 1 of hash-join block the pipeline!! Bushy Trees A B R S Sites 1-8 Sites 1-4 Sites 5-8

Parallel Query Optimization (Cont’d) Common approach: 2 phases Pick best sequential plan (System R algorithm) Pick degree of parallelism based on current system parameters. “Bind” operators to processors Take query tree, “decorate” as in previous picture.

Parallel DBMS Summary Parallelism natural to query processing: Both pipeline and partition parallelism! Shared-Nothing vs. Shared-Mem Shared-disk too, but less standard Shared-mem easy, costly. Doesn’t scaleup. Shared-nothing cheap, scales well, harder to implement. Intra-op, Inter-op, & Inter-query parallelism all possible.

Parallel DBMS Summary (Cont’d) Data layout choices important! Most DB operations can be done with partition-parallelism Sort. Sort-merge join, hash-join. Complex plans. Allow for pipeline-parallelism, but sorts, hashes block the pipeline. Partition parallelism achieved via bushy trees.

Parallel DBMS Summary (Cont’d) Hardest part of the equation: optimization. 2-phase optimization simplest, but can be ineffective. More complex schemes still at the research stage. We haven’t said anything about transactions, logging. Easy in shared-memory architecture. Takes some care in shared-nothing.