External Sorting KDD Laboratory外部排序 KDD实验室.ppt

合集下载
相关主题
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

Database Management Systems, R. Ramakrishnan and J. Gehrke
8
In Memory Sorting: Heap-Sorting
Heap-Sort Procedure
10
8
9
4
7 13
2
14 16
9
8
3
4
7 12
10 14 16
Database Management Systems, R. Ramakrishnan and J. Gehrke
Heap-Sort Procedure
8
7
3
4Βιβλιοθήκη Baidu
21
9 10 14 16
7
4
3
1
2
8 9 10 14 16
Database Management Systems, R. Ramakrishnan and J. Gehrke
11
In Memory Sorting: Heap-Sorting
Heap-Sort Procedure
8
7 93
14 8
7
24 1
What are the differences and the similarities
between these two heap trees?
Database Management Systems, R. Ramakrishnan and J. Gehrke
5
16
2. Heapsort Procedure
Database Management Systems, R. Ramakrishnan and J. Gehrke
4
In-Memory Sorting: Heap-Sorting
Build-Heap Procedure
4
1
3
How?
16
14
10
2
16
9 10
14
8
7
2
4
1
10 93
16
14
10
8
7 93
24 1
Database Management Systems, R. Ramakrishnan and J. Gehrke
6
In Memory Sorting: Heap-Sorting
Heap-Sort Procedure
16
14
10
8
7 93
24 1
9
In Memory Sorting: Heap-Sorting
Heap-Sort Procedure
9
8
3
4
7 12
10 14 16
8
7
3
4
21
9 10 14 16
Database Management Systems, R. Ramakrishnan and J. Gehrke
10
In Memory Sorting: Heap-Sorting
14
8
10
4
7 93
21
16
Database Management Systems, R. Ramakrishnan and J. Gehrke
7
In Memory Sorting: Heap-Sorting
Heap-Sort Procedure
14
8
10
4
7 93
21
16
10
8
9
4
7 13
2
14 16
7
4
3
1
2
8 9 10 14 16
2 1
4 3
7 8 9 10 14 16
Database Management Systems, R. Ramakrishnan and J. Gehrke
12
In Memory Sorting: Heap-Sorting
Heap-Sort Procedure
4
2
External Sorting
Chapter 13
Database Management Systems, R. Ramakrishnan and J. Gehrke
1
Why Sort?
A classic problem in computer science! Data requested in sorted order
External Sorting: When the size of file to be sorted is bigger than that of available memory!
Database Management Systems, R. Ramakrishnan and J. Gehrke
– e.g., find students in increasing gpa order – Nearest neighbor search also needs sorting!
Sorting is the first step in bulk loading B+ tree index. Sorting useful for eliminating duplicate copies in a collection of records (Why?) Sort-merge join algorithm involves sorting.
3
In-Memory Sorting: Heap-Sorting
Original Data Page
4 1 3 2 16 9 10 14 8 7
Sorted
16 14 10 9 8 7 4 3 2 1
Data Page
How can we obtain the sorted data page?
1. Build-Heap Procedure
Database Management Systems, R. Ramakrishnan and J. Gehrke
2
Sorting Types
In-Memory Sorting: When the size of memory is bigger than that of file to be sorted!
3
1
3
2
1
7 8 9 10 14 16
4 7 8 9 10 14 16
Database Management Systems, R. Ramakrishnan and J. Gehrke
13
In Memory Sorting: Heap-Sorting
Heap-Sort Procedure
3
2
1
2 1
4 7 8 9 10 14 16
3 4 7 8 9 10 14 16
Database Management Systems, R. Ramakrishnan and J. Gehrke
14
In Memory Sorting: Heap-Sorting
Heap-Sort Procedure
相关文档
最新文档