Docsity

Distributed Query Processing - Advanced Database System - Lecture Slides, Slides of Database Management Systems (DBMS)

Partial preview of the text

Download Distributed Query Processing - Advanced Database System - Lecture Slides and more Slides Database Management Systems (DBMS) in PDF only on Docsity!

Distributed Query Processing

Motivation

• Cost and scalability: network of off-shelf

machines

• Integration of different software vendors

(with own DBMS)

• Integration of legacy systems

• Applications inherently distributed, such as

workflow or collaborative-design

• State-of-the-art distributed information

technologies (e-businesses)

Problem Statement

• Input: Query such as „Biological objects in

study A referenced in a literature in journal Y“.

• Output: Answer

• Objectives:

  • response time, throughput, first answers, little IO,

• Centralized vs. Distributed Query Processing

  • same basic problem
  • but, more and different parameters, such(data sites

or available machine power) and objectives

Steps in Query Processing

  • Input: Declarative Query
    • SQL, XQuery, ...
  • Step 1: Translate Query into Algebra
    • Tree of operators (query plan generation)
  • Step 2: Optimize Query
    • Tree of operators (logical) - also select partitions of table
    • Tree of operators (physical) – also site annotations
    • (Compilation)
  • Step 3: Execution
    • Interpretation; Query result generation

Query Optimization

  • logical, e.g., push down cheap predicates
  • enumerate alternative plans, apply cost model
  • use search heuristics to find cheapest plan

A.d

A.a = B.b, A.c = 35

X

A B

A.d

hashjoin

B.b

index A.c B

Basic Query Optimization

• Classical Dynamic Programming algorithm

  • Performs join order optimization
  • Input : Join query on n relations
  • Output : Best join order

Query Execution

  • library of operators (hash join, merge join, ...)
  • exploit indexes and clustering in database
  • pipelining (iterator model)

A.d

hashjoin

B.b

index A.c B

(John, 35, CS) (Mary, 35, EE) (^) (Edinburgh, CS,5.0) (Edinburgh, AS, 6.0)

(CS)

(AS)

(John, 35, CS)

John

Summary : Centralized Queries

• Basic SQL (SPJG, nesting) well understood

• Very good extensibility

  • spatial joins, time series, UDF, xquery, etc.

• Current problems

  • Better statistics : cost model for optimization
  • Physical database design expensive & complex

• Some Trends

  • interactiveness during execution
  • approximate answers, top-k
  • self-tuning capabilities (adaptive; robust; etc.)

Issues in Distributed Databases

  • Plan enumeration
    • The time and space complexity of traditional dynamic programming algorithm is very large
    • Iterative Dynamic Programming (heuristic for large queries)
  • Cost Models
    • Classic Cost Model
    • Response Time Model
    • Economic Models

Distributed Query Plan

A.d

hashjoin

B.b

index A.c B

receive receive

send send

Forms Of Parallelism?

Another Metric : Response Time

Total Cost = 40 first tuple = 25 last tuple = 33

first tuple = 0 last tuple = 10

Pipelined parallelism

Independent parallelism

Query Execution Techniques for

Distributed Databases

  • Row Blocking
  • Multi-cast optimization
  • Multi-threaded execution
  • Joins with horizontal partitioning
  • Semi joins
  • Top n queries

Query Execution Techniques for DD

  • Multi-cast Optimization
    • Location of sending/receiving may affect communication costs; forwarding versus multi-casting
  • Multi-threaded execution
    • Several threads for operators at the same site (intra-query parallelism)
    • May be useful to enable concurrent reads for diverse machines (while continuing query processing)
    • Must consider if resources warrant concurrent operator execution (say two sorts each needing all memory)

Query Execution Techniques for DD

  • Joins with Data (horizontal) partitioning:
    • Hash-based partitioning to conduct joins on independent partitions
  • Semi Joins :
    • Reduce communication costs; Send only “join keys” instead of complete tuples to the site to extract relevant join partners
  • Double-pipelined hash joins :
    • Non-blocking join operators to deliver first results quickly; fully exploit pipelined parallelism, and reduce overall response time
  • Top n queries :
    • Isloate top n tuples quickly and only perform other expensive operations (like sort, join, etc) on those few (use “stop” operators)