Implementation of Database Systems, Jarek Gryz 1 Parallel DBMS Chapter 22, Part A.

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.
Query Execution, Concluded Zachary G. Ives University of Pennsylvania CIS 550 – Database & Information Systems November 18, 2003 Some slide content may.
Parallel Databases These slides are a modified version of the slides of the book “Database System Concepts” (Chapter 18), 5th Ed., McGraw-Hill, by Silberschatz,
Parallel Databases By Dr.S.Sridhar, Ph.D.(JNUD), RACI(Paris, NICE), RMR(USA), RZFM(Germany) DIRECTOR ARUNAI ENGINEERING COLLEGE TIRUVANNAMALAI.
04/25/2005Yan Huang - CSCI5330 Database Implementation – Parallel Database Parallel Databases.
Database Management Systems, 2 nd Edition. Raghu Ramakrishnan and Johannes Gehrke1 Parallel Database Systems Taken/tweaked from the Wisconsin DB book slides.
Database Management Systems 3ed, R. Ramakrishnan and Johannes Gehrke1 Evaluation of Relational Operations: Other Techniques Chapter 14, Part B.
Parallel Database Systems
Parallel Database Systems
Data Warehousing 1 Lecture-25 Need for Speed: Parallelism Methodologies Virtual University of Pakistan Ahsan Abdullah Assoc. Prof. & Head Center for Agro-Informatics.
External Sorting CS634 Lecture 10, Mar 5, 2014 Slides based on “Database Management Systems” 3 rd ed, Ramakrishnan and Gehrke.
Parallel DBMS Slides adapted from textbook; from Joe Hellerstein; and from Jim Gray, Microsoft Research. DBMS Textbook Chapter 22.
1  Simple Nested Loops Join:  Block Nested Loops Join  Index Nested Loops Join  Sort Merge Join  Hash Join  Hybrid Hash Join Evaluation of Relational.
SPRING 2004CENG 3521 Join Algorithms Chapter 14. SPRING 2004CENG 3522 Schema for Examples Similar to old schema; rname added for variations. Reserves:
©Silberschatz, Korth and Sudarshan13.1Database System Concepts Chapter 13: Query Processing Overview Measures of Query Cost Selection Operation Sorting.
Chapter 1 Introduction 1.1A Brief Overview - Parallel Databases and Grid Databases 1.2Parallel Query Processing: Motivations 1.3Parallel Query Processing:
Parallel DBMS Chapter 22, Part A
Query Optimization 3 Cost Estimation R&G, Chapters 12, 13, 14 Lecture 15.
Institut für Scientific Computing – Universität WienP.Brezany Parallel Databases Univ.-Prof. Dr. Peter Brezany Institut für Scientific Computing Universität.
Manajemen Basis Data Pertemuan 11 Matakuliah: M0264/Manajemen Basis Data Tahun: 2008.
1 External Sorting Chapter Why Sort?  A classic problem in computer science!  Data requested in sorted order  e.g., find students in increasing.
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:
1 External Sorting for Query Processing Yanlei Diao UMass Amherst Feb 27, 2007 Slides Courtesy of R. Ramakrishnan and J. Gehrke.
TDD: Topics in Distributed Databases
CS 4432query processing - lecture 171 CS4432: Database Systems II Lecture #17 Join Processing Algorithms (cont). Professor Elke A. Rundensteiner.
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
©Silberschatz, Korth and Sudarshan13.1Database System Concepts Chapter 13: Query Processing Overview Measures of Query Cost Selection Operation Sorting.
Chapter 21: Parallel Databases Chapter 21: Parallel Databases Introduction I/O Parallelism Interquery Parallelism Intraquery Parallelism Intraoperation.
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.
RELATIONAL JOIN Advanced Data Structures. Equality Joins With One Join Column External Sorting 2 SELECT * FROM Reserves R1, Sailors S1 WHERE R1.sid=S1.sid.
Implementing Natural Joins, R. Ramakrishnan and J. Gehrke with corrections by Christoph F. Eick 1 Implementing Natural Joins.
Parallel Database Systems Instructor: Dr. Yingshu Li Student: Chunyu Ai.
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 18: Parallel.
CPT-S Topics in Computer Science Big Data 1 Yinghui Wu EME 49.
Mapping the Data Warehouse to a Multiprocessor Architecture
©Silberschatz, Korth and Sudarshan18.1Database System Concepts - 6 th Edition Chapter 18: Parallel Databases Introduction I/O Parallelism Interquery Parallelism.
Lecture 14- Parallel Databases Advanced Databases Masood Niazi Torshiz Islamic Azad University- Mashhad Branch
Computing & Information Sciences Kansas State University Monday, 03 Nov 2008CIS 560: Database System Concepts Lecture 27 of 42 Monday, 03 November 2008.
Database System Concepts, 5th Ed. ©Silberschatz, Korth and Sudarshan Chapter 21: Parallel Databases.
©Silberschatz, Korth and Sudarshan20.1Database System Concepts 3 rd Edition Chapter 20: Parallel Databases Introduction I/O Parallelism Interquery Parallelism.
Query Processing CS 405G Introduction to Database Systems.
CS 440 Database Management Systems Lecture 5: Query Processing 1.
Lecture 3 - Query Processing (continued) Advanced Databases Masood Niazi Torshiz Islamic Azad university- Mashhad Branch
Computing & Information Sciences Kansas State University Wednesday, 08 Nov 2006CIS 560: Database System Concepts Lecture 32 of 42 Monday, 06 November 2006.
Introduction to Database Systems1 External Sorting Query Processing: Topic 0.
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.
Unit - 4 Introduction to the Other Databases.  Introduction :-  Today single CPU based architecture is not capable enough for the modern database.
CS 540 Database Management Systems
Alon Levy 1 Relational Operations v We will consider how to implement: – Selection ( ) Selects a subset of rows from relation. – Projection ( ) Deletes.
Database Management Systems, R. Ramakrishnan and J. Gehrke1 External Sorting Chapter 11.
External Sorting. Why Sort? A classic problem in computer science! Data requested in sorted order –e.g., find students in increasing gpa order Sorting.
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.
Evaluation of Relational Operations
April 30th – Scheduling / parallel
Implementation of Relational Operations (Part 2)
Akshay Tomar Prateek Singh Lohchubh
Parallel DBMS Chapter 22, Part A
Parallel DBMS Chapter 22, Sections 22.1–22.6
Parallel DBMS DBMS Textbook Chapter 22
Presentation transcript:

Implementation of Database Systems, Jarek Gryz 1 Parallel DBMS Chapter 22, Part A

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

Implementation of Database Systems, Jarek Gryz 3 Parallel DBMS: Intro Parallelism is natural to DBMS processing  Pipeline parallelism: many machines each doing one step in a multi-step process.  Partition parallelism: many machines doing the same thing to different pieces of data.  Both are natural in DBMS! Pipeline Partition Any Sequential Program Any Sequential Program Sequential Any Sequential Program Any Sequential Program outputs split N ways, inputs merge M ways

Implementation of Database Systems, Jarek Gryz 4 DBMS: The || Success Story DBMSs are the most (only?) successful application of parallelism.  Teradata, Tandem vs. Thinking Machines, KSR..  Every major DBMS vendor has some || server  Workstation manufacturers now depend on || DB server sales. Reasons for success:  Bulk-processing (= partition ||-ism).  Natural pipelining.  Inexpensive hardware can do the trick!  Users/app-programmers don’t need to think in ||

Implementation of Database Systems, Jarek Gryz 5 Some || Terminology Speed-Up  More resources means proportionally less time for given amount of data. Scale-Up  If resources increased in proportion to increase in data size, time is constant. degree of ||-ism Xact/sec. (throughput) Ideal degree of ||-ism sec./Xact (response time) Ideal

Implementation of Database Systems, Jarek Gryz 6 Architecture Issue: Shared What? 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

Implementation of Database Systems, Jarek Gryz 7 What Systems Work This Way Shared Nothing Teradata: 400 nodes Tandem: 110 nodes IBM / SP2 / DB2: 128 nodes Informix/SP2 48 nodes Shared Disk Oracle170 nodes DEC Rdb 24 nodes Shared Memory Informix 9 nodes

Implementation of Database Systems, Jarek Gryz 8 Different Types of DBMS ||-ism 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 ||-ism

Implementation of Database Systems, Jarek Gryz 9 Automatic Data Partitioning Partitioning a table: RangeHashRound Robin Shared disk and memory less sensitive to partitioning, Shared nothing benefits from "good" partitioning A...E F...J K...NO...ST...Z A...E F...JK...NO...S T...Z A...EF...J K...N O...S T...Z Good for equijoins, range queries group-by Good for equijoins Good to spread load

Implementation of Database Systems, Jarek Gryz 10 Parallel Scans Scan in parallel, and merge. Selection may not require all sites for range or hash partitioning. Indexes can be built at each partition. Question: How do indexes differ in the different schemes?  Think about both lookups and inserts!

Implementation of Database Systems, Jarek Gryz 11 Parallel Sorting Current records:  8.5 Gb/minute, shared-nothing; Datamation benchmark in 2.41 secs Idea:  Scan in parallel, and range-partition as you go.  As tuples come in, begin “local” sorting on each  Resulting data is sorted, and range-partitioned.  Problem: skew!  Solution: “sample” the data at start to determine partition points.

Implementation of Database Systems, Jarek Gryz 12 Parallel Aggregates For each aggregate function, need a decomposition:  count (S) =  count (s(i)), ditto for sum ()  avg (S) = (  sum (s(i))) /  count (s(i))  and so on... For groups:  Sub-aggregate groups close to the source.  Pass each sub-aggregate to its group’s site. Chosen via a hash fn.

Implementation of Database Systems, Jarek Gryz 13 Parallel Joins Nested loop:  Each outer tuple must be compared with each inner tuple that might join.  Easy for range partitioning on join cols, hard otherwise! Sort-Merge (or plain Merge-Join):  Sorting gives range-partitioning. But what about handling 2 skews?  Merging partitioned tables is local.

Implementation of Database Systems, Jarek Gryz 14 Parallel Hash Join 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. Original Relations (R then S) OUTPUT 2 B main memory buffers Disk INPUT 1 hash function h B-1 Partitions 1 2 B-1... Phase 1

Implementation of Database Systems, Jarek Gryz 15 Dataflow Network for || Join Good use of split/merge makes it easier to build parallel versions of sequential join code.

Implementation of Database Systems, Jarek Gryz 16 Complex Parallel Query Plans Complex Queries: Inter-Operator parallelism  Pipelining between operators: note that sort and phase 1 of hash-join block the pipeline!!  Bushy Trees A BRS Sites 1-4Sites 5-8 Sites 1-8

Implementation of Database Systems, Jarek Gryz 17 N  M-way Parallelism N inputs, M outputs, no bottlenecks. Partitioned Data Partitioned and Pipelined Data Flows

Implementation of Database Systems, Jarek Gryz 18 Observations It is relatively easy to build a fast parallel query executor It is hard to write a robust and world-class parallel query optimizer.  There are many tricks.  One quickly hits the complexity barrier.  Still open research!

Implementation of Database Systems, Jarek Gryz 19 Parallel Query Optimization 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.

Implementation of Database Systems, Jarek Gryz 20 Best serial plan != Best || plan! Why? Trivial counter-example:  Table partitioned with local secondary index at two nodes  Range query: all of node 1 and 1% of node 2.  Node 1 should do a scan of its partition.  Node 2 should use secondary index. SELECT * FROM telephone_book WHERE name < “NoGood”; What’s Wrong With That? N..Z Table Scan A..M Index Scan

Implementation of Database Systems, Jarek Gryz 21 Parallel DBMS Summary ||-ism natural to query processing:  Both pipeline and partition ||-ism! 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 ||-ism all possible.

Implementation of Database Systems, Jarek Gryz 22 || DBMS Summary, cont. Data layout choices important! Most DB operations can be done partition-||  Sort.  Sort-merge join, hash-join. Complex plans.  Allow for pipeline-||ism, but sorts, hashes block the pipeline.  Partition ||-ism achieved via bushy trees.

Implementation of Database Systems, Jarek Gryz 23 || DBMS Summary, cont. 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 Xacts, logging.  Easy in shared-memory architecture.  Takes some care in shared-nothing.