Topic 4: Query Optimization Chapters 12 and 15 of Cow Book
Arun Kumar
1
CSE 232A Graduate Database Systems
Slide ACKs: Jignesh Patel, Paris Koutris
CSE 232A Graduate Database Systems Arun Kumar Topic 4: Query - - PowerPoint PPT Presentation
CSE 232A Graduate Database Systems Arun Kumar Topic 4: Query Optimization Chapters 12 and 15 of Cow Book Slide ACKs: Jignesh Patel, Paris Koutris 1 Lifecycle of a Query Query Result Query Database Server Query Execute Parser
1
Slide ACKs: Jignesh Patel, Paris Koutris
2
Query Query Result
Query Syntax Tree and Logical Query Plan Parser Physical Query Plan Optimizer Segments Query Scheduler
|…|……|………..|………..| |…|……|………..|………..| |…|……|………..|………..| |…|……|………..|………..| |…|……|………..|………..| |…|……|………..|………..| |…|……|………..|………..| |…|……|………..|………..| |…|……|………..|………..| |…|……|………..|………..| |…|……|………..|………..|Query Result Execute Operators
3
4
5
SELECT R.stars = 5 Ratings Table SELECT No predicate Movies Table JOIN R.MID = M.MID GROUP BY AGGREGATE M.Year, COUNT(*) SORT On NumBest Result Table
6
Indexed Access Use Index on Stars Ratings Table File Scan Read heapfile Movies Table Index-Nested Loop Join Sort-based Aggregate External Merge-Sort In-mem quicksort; B=50 Result Table
7
File Scan Read Index leaf pages Ratings Table File Scan Read heapfile Movies Table Hash Join Hash-based Aggregate External Merge-Sort In-mem quicksort; B=50 Result Table
8
9
10
11
12
13
14
15
File Scan Read Index leaf pages Movies Table File Scan Read heapfile RatingsTable Hash Join Hash-based Aggregate External Merge-Sort In-mem quicksort; B=50 Result Table
16
17
18
File Scan Read heapfile Movies Table File Scan Read heapfile RatingsTable Sort-Merge Join Hash-based Aggregate External Merge-Sort In-mem quicksort; B=50 Result Table
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
“Access Path Selection in a Relational Database Management System” SIGMOD’79
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50