Presentation is loading. Please wait.

Presentation is loading. Please wait.

HW7: Sort-Merge Join Instructors: Winston Hsu, Hao-Hua Chu Fall 2012.

Similar presentations


Presentation on theme: "HW7: Sort-Merge Join Instructors: Winston Hsu, Hao-Hua Chu Fall 2012."— Presentation transcript:

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


Download ppt "HW7: Sort-Merge Join Instructors: Winston Hsu, Hao-Hua Chu Fall 2012."

Similar presentations


Ads by Google