- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
(数据库原理课件)Chapter10 Query Processing教材课程.ppt
External Sort-Merge (Cont.) Merge the runs (N-way merge). We assume (for now) that N M. Use N blocks of memory to buffer input runs, and 1 block to buffer output. Read the first block of each run into its buffer page repeat Select the first record (in sort order) among all buffer pages Write the record to the output buffer. If the output buffer is full write it to disk. Delete the record from its input buffer page.If the buffer page becomes empty then read the next block (if any) of the run into the buffer. until all input buffer pages are empty: External Sort-Merge (Cont.) If N ? M, several merge passes are required. In each pass, contiguous groups of M - 1 runs are merged. A pass reduces the number of runs by a factor of M -1, and creates runs longer by the same factor. E.g. If M=11, and there are 90 runs, one pass reduces the number of runs to 9, each 10 times the size of the initial runs Repeated passes are performed till all runs have been merged into one. Example: External Sorting Using Sort-Merge External Merge Sort (Cont.) Cost analysis: 1 block per run leads to too many seeks during merge Instead use bb buffer blocks per run ? read/write bb blocks at a time Can merge ?M/bb?–1 runs in one pass Total number of merge passes required: ?log ?M/bb?–1(br/M)?. Block transfers for initial run creation as well as in each pass is 2br for final pass, we don’t count write cost we ignore final write cost for all operations since the output of an operation may be sent to the parent operation without being written to disk Thus total number of block transfers for external sorting: br ( 2 ?log ?M/bb?–1 (br / M)? + 1) ? Seeks: next slide External Merge Sort (Cont.) Cost of seeks During run generation: one seek to read each run and one seek to write each run 2 ?br / M? During the merge phase Need 2 ?br / bb? seeks for each merge pass except the final one which does not require a write Total number of seeks: 2 ?br / M? + ?br / bb? (2 ?log?M/bb?–1(br / M)
您可能关注的文档
- (振动理论课件)单自由度系统阻尼自由振动-b教学教材.ppt
- (振动理论课件)多自由度系统的振动-续(2nd)知识讲稿.ppt
- (振动理论课件)多自由度系统的振动B知识介绍.ppt
- (振动理论课件)振动理论绪论A教程文件.ppt
- (振动理论课件)振动系统及其力学模型A讲解材料.ppt
- (振动理论课件)线性系统的受迫振动-4讲解材料.ppt
- (振动理论课件)自激振动A讲解材料.ppt
- (振动理论课件)非线性振动概述知识讲稿.ppt
- (控制工程课件)CH2_控制系统的数学模型知识讲稿.ppt
- (控制工程课件)CH4_控制系统的频率特性教程文件.ppt
- (数据库原理课件)Chapter11 Query Processing教材课程.ppt
- (数据库原理课件)Chapter12 Query Optimization教材课程.ppt
- (数据库原理课件)Chapter12 Security教学教材.ppt
- (数据库原理课件)Chapter13 Transaction教学教材.ppt
- (数据库原理课件)Chapter14 Concurrency教程文件.ppt
- (数据库原理课件)Chapter15 Recovery教材课程.ppt
- (数据库原理课件)Chapter2 Database System Development Lifecycle教材课程.ppt
- (数据库原理课件)Chapter2 The StayHome Case study知识介绍.ppt
- (数据库原理课件)Chapter3-1 Relational Theory教学教材.ppt
- (数据库原理课件)Chapter4 Conceptual Design宣讲培训.ppt
最近下载
- 2024年智慧水产养殖解决方案.pptx VIP
- 三年级上册班队活动教案(16次).doc VIP
- 小学二年级地方课教案.docx VIP
- 高中课件:原创历史第4课 西汉与东汉——统一多民族封建国家的巩固.pptx
- NBT47041_2014塔式容器国家标准.pdf VIP
- 《水文自动测报系统技术规范》(SL61-2003).pdf VIP
- 2024廉政教育警示党课违反廉洁纪律案例剖析党课PPT.pptx VIP
- 纪念中国人民抗日战争暨世界反法西斯战争胜利80周年主题党课PPT(优质ppt).pptx VIP
- 第一章第二节牵出线调车作业概要.ppt VIP
- 气瓶安全使用与管理规范.pptx VIP
文档评论(0)