110 likes | 256 Views
HW7: Sort-Merge Join. Instructors: Winston Hsu, Hao-Hua Chu Fall 2012. Architecture of a DBMS. Query. Query Optimization and Execution. Relation Operators(Join). File and Access Methods. Buffer Management. Disk Space Management. DB. Merge Sort. Sort by sname. Get the first tuples.
E N D
HW7: Sort-Merge Join Instructors: Winston Hsu, Hao-HuaChu Fall 2012
Architecture of a DBMS Query Query Optimization and Execution Relation Operators(Join) File and Access Methods Buffer Management Disk Space Management DB
MergeSort Sort by sname Get the first tuples Merge
Task 1: Sort • Sort::Sort(…) • Specifies input file name and output file name
Task 2: Storage & Scan • HeapFile::HeapFile(…) • Open data with HeapFile • HeapFile::openScan(…) • Returns a scan of the HeapFile • Scan::getNext(…) • Get next record
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.
Output • Format: if = ,then write recR recB recR recB
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