Click here to load reader

CS3223 Tutorial 4

Embed Size (px)

DESCRIPTION

CS3223 Tutorial 4. Fan Qi [email protected] Database Lab 1, com1 #01-08. Block I/O Sorting. Key Idea: R/W multi page per I/O Cost: Number of Passes:. 1 block for output. Selection. Access: Table Scan Index Scan Index Seek Index Intersection Index Access: - PowerPoint PPT Presentation

Citation preview

CS3223 Tutorial 2

Fan Qi [email protected] Lab 1, com1 #01-08CS3223 Tutorial 4Block I/O Sorting 1 block for outputSelectionAccess:Table ScanIndex ScanIndex SeekIndex Intersection

Index Access:B+ Tree : range and equalityHash : equality only

CostB+ TreeNavigation costLeaf page scan costRID look up costHash IndexChain Cost (Reading Bucket Page into Memory)RID look up costQuestion 1Question 1Disk123203213226406416429609619621280MemoryininininoutQuestion 1Question 1Take-away pointsBlock I/O reduces sorting timeDiminishing return at some point, why?In practice, read/write block are of the same sizeSortTime319-Merge640,000,000ms256-Merge, 1 in 64 out344,687,500ms16-Merge, 16 in 64 out126,875,000ms8-Merge, 32 in 64 out135,156,250ms4-Merge,64 in 64 out195,500,000msWhy? As block size increases, the number of passes slightly increase as well7Question 31. Table ScanDiskQuestion 3pr250 pagesRid Look up to get name Question 3pr250 pages500 pagesIntersectDiskRid Look up to get name Question 3Diskp200 pagesRid Look up to get name for each record Question 4Question 4Thank you!Happy Recess Week!