1 / 12

第 9 章 查询处理和查询优化

第 9 章 查询处理和查询优化. 实验及作业点评. 实验情况. 实验报告评分:. 实验之星. 2008202342 张映悦 2008202348 邢 哲 2008202350 郭 双 2008202362 任乔意 2008202362 干艳桃. 问题总结. 实验报告 截图 vs 图表 实验完成后的总结和分析. 作业 1 批改情况. 作业 1 优秀作业. 2008202357 马 迪 2008202358 吴梦迪

kalea
Télécharger la présentation

第 9 章 查询处理和查询优化

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 第9章 查询处理和查询优化 实验及作业点评

  2. 实验情况 • 实验报告评分:

  3. 实验之星 • 2008202342 张映悦 • 2008202348 邢 哲 • 2008202350 郭 双 • 2008202362 任乔意 • 2008202362 干艳桃

  4. 问题总结 • 实验报告 • 截图 vs 图表 • 实验完成后的总结和分析

  5. 作业1批改情况

  6. 作业1 优秀作业 • 2008202357 马 迪 • 2008202358 吴梦迪 • 2008202359 刘于绰 • 2008202362 任乔意

  7. 作业2批改情况

  8. 补充题1 • 题目条件: • R: 10000 tuples, S: 8000 tuple, 每个元组 200 Bytes • pageSize = 2KB • R.A 和 S.B 属性值为6 Bytes, 指针 4 Bytes • R.A 和 S.B 是distinct • R.A上有Primary Index,S.B上有Secondary Index • BufferSize >= 5 pages • Join Result : 50 tuples • Describe a variation of the Sort-Merge join algorithm which utilizes the leaf nodes of the two indexes to perform the join.

  9. 补充题1 • 算法实现Step 1: • 由于A、B属性上分别有主索引和辅索引,因此两个属性上的B+索引的页结点是有序的,因此可对A、B属性上索引的叶子节点进行sort-merge join,结果为R元组的的地址和S元组地址。 • 代价: • pageSize = 2KB, <属性值,指针> 10Bytes,最坏情况考虑索引页结点为半满情况,因此每个页结点的扇出fi为: fi = (2KB/10Bytes)/2 = 100 • 索引高度计算:HTA = 2, HTB = 2 • A、B索引叶结点页数: BA = 10000/100 = 100页, BB = 8000/100 = 80页 • 索引叶结点Sort-Merge代价: 100 + 80 = 180页

  10. 补充题1 • 算法实现Step 2: • 由于连接结果相对于原表元组数较少(50个元组),因此可以不对S地址进行排序,直接读取R和S的相应块。 • 代价: • 最坏情况下连接结果分别来自于A、B属性的不同页中,其代价为: 50 + 50 = 100页 • 算法总代价:180页 +100页 = 280页 • 典型错误 • 每个叶子结点有200个指针(错误原因:应按最差情况叶结点半满计算) • 总代价加上了索引高度(错误原因:B+树第一个叶子结点的地址能够直接获取) • 以R作为外表,扫描S表索引叶子结点(错误原因:没有充分利用题目条件,不符合sort-merge join的要求)

  11. 补充题2 • 考核要点:启发式优化方法 • 典型问题: • 题目要求给出使用每一条优化规则后的查询树,很多同学没有写出具体步骤,只给出最后结果。 • 许多同学没有考虑连接顺序的优化,本题中有两种连接顺序(Departments Participate) Projects和Departments (Participate Projects)选择那种顺序? • 根据题目的提示:most projects have budget higher than 1 million and very few projects are located in Binghamton ,第一种连接顺序中间结果小,所以应该选择第一种连接顺序。

  12. 关于课程实验 • Demo预演示: • 周日晚18:30 • 理工配楼一层会议室 • 课程设计汇报: • 下周二(12月28日)上午9:00-12:00 • PPT展示及系统Demo • 信息楼四层报告厅

More Related