Download presentation
Presentation is loading. Please wait.
Published byLorin Pearson Modified over 9 years ago
1
HW7: Sort-Merge Join Instructors: Winston Hsu, Hao-Hua Chu Fall 2012
2
Architecture of a DBMS Query Query Optimization and Execution DB File and Access Methods Buffer Management Disk Space Management Relation Operators(Join)
3
snameBID C118 B112 A A168 B101 Merge Sort sidsname 31A 22A 36C 44D 28E sidsname 31A 28E 22A 36C 44D snameBID A112 A168 B112 B101 C118 sidsnameBID 31A112 31A168 22A112 22A168 36C118 Sort by sname Get the first tuples Merge
4
Pseudo Code
5
Task 1: Sort Sort::Sort(…) – Specifies input file name and output file name
6
Task 2: Storage & Scan HeapFile::HeapFile(…) – Open data with HeapFile HeapFile::openScan(…) – Returns a scan of the HeapFile Scan::getNext(…) – Get next record
7
Task 3: Merge tupleCmp() – Compare tuples HeapFile::insertRecord(…) – Insert a record into the file Scan::position(…) – Position the scan cursor to the record with rid.
8
Heap File
9
Output Format: recR recB if = =,then write recR recB
10
Administration If there are any questions, you can post them on ptt.cc / CSIE_DBMS, or mail to: woptspencil@gmail.com Deadline: 23:59 Jan 9 (Wednesday), 2013
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.