Parallel DBMS-Database Management Systems-Lecture 24 Slides-Computer Science, Slides of Database Management Systems (DBMS)

Parallel DBMS, Shared Memory, Shared Disk, Automatic Data Partitioning, Parallel Scans, Parallel Sorting, Parallel Aggregates, Parallel Joins, Parallel Hash Join, Complex Parallel Query Plans, Database Management Systems, Raghu Ramakrishnan, Lecture Slides, Computer Science, University of Wisconsin, United States of America

Typology: Slides

2011/2012

Uploaded on 02/15/2012

arien
arien 🇺🇸

4.8

(24)

309 documents

1 / 8

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Database Management Systems, 2ndEdition. Raghu Ramakrishnan and Johannes Gehrke 1
Parallel DBMS
Slides by Joe Hellerstein, UCB, with some material from
Jim Gray, Microsoft Research. See also:
http://www.research.microsoft.com/research/BARC/Gray/PD B95.ppt
Chapter 22, Part A
Database Management Systems, 2ndEdition. Raghu Ramakrishnan and Johannes Gehrke 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
Database Management Systems, 2ndEdition. Raghu Ramakrishnan and Johannes Gehrke 3
Parallel DBMS: Intro
YParallelism 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
Sequential SequentialSequential Any
Sequential
Program
Any
Sequential
Program
outputs split N ways, inputs merge M ways
pf3
pf4
pf5
pf8

Partial preview of the text

Download Parallel DBMS-Database Management Systems-Lecture 24 Slides-Computer Science and more Slides Database Management Systems (DBMS) in PDF only on Docsity!

Database Management Systems, 2nd^ Edition. Raghu Ramakrishnan and Johannes Gehrke 1

Parallel DBMS

Slides by Joe Hellerstein, UCB, with some material from Jim Gray, Microsoft Research. See also: http://www.research.microsoft.com/research/BARC/Gray/PDB95.ppt

Chapter 22, Part A

Database Management Systems, 2nd^ Edition. Raghu Ramakrishnan and Johannes Gehrke 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

Parallel DBMS: Intro

Y 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

SequentialAny Program SequentialAny Program

SequentialSequential Sequential SequentialSequentialAny Program SequentialAny Program outputs split N ways, inputs merge M ways

Database Management Systems, 2nd^ Edition. Raghu Ramakrishnan and Johannes Gehrke 4

DBMS: The || Success Story

Y 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.

Y Reasons for success:

  • Bulk-processing (= partition ||-ism).
  • Natural pipelining.
  • Inexpensive hardware can do the trick!
  • Users/app-programmers don’t need to think in ||

Database Management Systems, 2nd^ Edition. Raghu Ramakrishnan and Johannes Gehrke 5

Some || Terminology

Y Speed-Up

  • More resources means proportionally less time for given amount of data.

Y 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

Architecture Issue: Shared What?

Shared Memory (SMP)

Shared Disk Shared Nothing (network)

CLIENTS CLIENTS 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, SP

Database Management Systems, 2nd^ Edition. Raghu Ramakrishnan and Johannes Gehrke 10

Parallel Scans

Y Scan in parallel, and merge.

Y Selection may not require all sites for range or

hash partitioning.

Y Indexes can be built at each partition.

Y Question: How do indexes differ in the

different schemes?

  • Think about both lookups and inserts!
  • What about unique indexes?

Database Management Systems, 2nd^ Edition. Raghu Ramakrishnan and Johannes Gehrke 11

Parallel Sorting

Y Current records:

  • 8.5 Gb/minute, shared-nothing; Datamation benchmark in 2.41 secs (UCB students! http://now.cs.berkeley.edu/NowSort/)

Y 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.

Jim Gray & Gordon Bell: VLDB 95 Parallel Database Systems SurveyDatabase Management Systems, 2nd^ Edition. Raghu Ramakrishnan and Johannes Gehrke 12

Parallel Aggregates

A...E F...J K...N O...S T...Z

A Table

Count Count Count Count Count

Count

Y 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...

Y For groups:

  • Sub-aggregate groups close to the source.
  • Pass each sub-aggregate to its group’s site. X Chosen via a hash fn.

Database Management Systems, 2nd^ Edition. Raghu Ramakrishnan and Johannes Gehrke 13

Parallel Joins

Y Nested loop:

  • Each outer tuple must be compared with each inner tuple that might join.
  • Easy for range partitioning on join cols, hard otherwise!

Y Sort-Merge (or plain Merge-Join):

  • Sorting gives range-partitioning. X But what about handling 2 skews?
  • Merging partitioned tables is local.

Database Management Systems, 2nd^ Edition. Raghu Ramakrishnan and Johannes Gehrke 14

Parallel Hash Join

Y In first phase, partitions get distributed to

different sites:

  • A good hash function automatically distributes work evenly!

Y Do second phase at each site.

Y Almost always the winner for equi-join.

Original Relations (R then S)

OUTPUT 2

Disk B main memory buffers^ Disk

INPUT

1 functionhash h B-

Partitions 1 2

B-

... Phase 1

Dataflow Network for || Join

Y Good use of split/merge makes it easier to

build parallel versions of sequential join code.

Database Management Systems, 2nd^ Edition. Raghu Ramakrishnan and Johannes Gehrke 19

Parallel Query Optimization

Y Common approach: 2 phases

  • Pick best sequential plan (System R algorithm)
  • Pick degree of parallelism based on current system parameters.

Y “Bind” operators to processors

  • Take query tree, “decorate” as in previous picture.

Database Management Systems, 2nd^ Edition. Raghu Ramakrishnan and Johannes Gehrke 20

Y Best serial plan != Best || plan! Why?

Y 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.

Y SELECT *

FROM telephone_book

WHERE name < “NoGood”;

What’s Wrong With That?

N..Z

Table Scan

A..M

Index Scan

Parallel DBMS Summary

Y ||-ism natural to query processing:

  • Both pipeline and partition ||-ism!

Y 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.

Y Intra-op, Inter-op, & Inter-query ||-ism all

possible.

Database Management Systems, 2nd^ Edition. Raghu Ramakrishnan and Johannes Gehrke 22

|| DBMS Summary, cont.

Y Data layout choices important!

Y Most DB operations can be done partition-||

  • Sort.
  • Sort-merge join, hash-join.

Y Complex plans.

  • Allow for pipeline-||ism, but sorts, hashes block the pipeline.
  • Partition ||-ism acheived via bushy trees.

|| DBMS Summary, cont.

Y Hardest part of the equation: optimization.

  • 2-phase optimization simplest, but can be ineffective.
  • More complex schemes still at the research stage.

Y We haven’t said anything about Xacts,

logging.

  • Easy in shared-memory architecture.
  • Takes some care in shared-nothing.