External Sort
Database Systems: The Complete Book
- Ch. 15.4
1
External Sort Database Systems: The Complete Book Ch. 15.4 1 - - PowerPoint PPT Presentation
External Sort Database Systems: The Complete Book Ch. 15.4 1 Operator Memory Needed Project O(1) Select O(1) Bag Union O(1) Join O(1) or O( |R|+|S| ) Group O( |G| ) Distinct O( |R| ) Sort O( |R| ) 2 You can get away with almost
Database Systems: The Complete Book
1
2
Project Bag Union Select Join Group Distinct Operator Memory Needed O(1) O(1) O(1) O(1) or O( |R|+|S| ) O( |G| ) O( |R| ) Sort O( |R| )
3
You can get away with almost no disk-based algorithms… … as long as you have external sort.
4
image credit: openclipart.org
5
6
3,4 6,2 9,4 8,7 5,6 3,1 2 3,4 2,6 4,9 7,8 5,6 1,3 2 2,3 4,6 4,7 8,9 5,6 1,3 2 2,3 4,4 6,7 8,9 6 3,5 1,2 2,3 4,5 6,6 9 7,8 3,4 1,2
7
2 · #pages · #passes
8
tuples into the working set.
9
10
11
How do we use sorted data to implement other memory-bound operators?
12
13
Joins
14
15
Distinct
16
17
18
Group-By
19
3,8 1,1 5,4 2,2 5,9 4,3 1,5 6,7
20
3,8 1,1 5,9 2,2 5,4 4,3 1,5 6,7