- 1、本文档共40页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
数据库系统原理复习讲述
第14章 Query Optimization 关系代数等价变换规则 基于代价最小的和启发式查询优化方法 做题(注意利用选择、投影简化查询) June 2010 Database System Concepts -Final Examination * Step1:使用rule1,将conjunctive(连接的) selection 分解为多个单独的选择操作,以使单个选择操作尽可能沿查询树下移(尽早执行选择操作,以减少中间计算结果) Step2:根据选择操作的交换率和分配率,利用rule2, rule7.a, rule7.b, rule11, 将查询树上的每个选择操作尽可能移向叶节点,以便尽早执行选择操作 Step3:根据连接操作的结合律和交换率,使用rule6,重新安排查询树中的叶结点,使得具有restrictive selection特征的叶结点先执行 restrictive selection:执行此操作后,产生的结果关系最小(所含元组最少) Steps in Heuristic Optimization Step4:利用rule4.a, 以连接操作代替相邻的选择和笛卡尔乘积操作 Step5:利用rule3, 8.a, 8.b,12, 将查询树上的投影操作尽可能下移,以便尽早执行投影操作,减少中间计算结果 Step6:将最后的查询树分解为多个子树,使子树中的各操作可以采用流水线方式执行(见第13章13.7.2中关于流水线的介绍),以减少对外设的访问次数,e.g. Fig.14.5 (见书上) 流水线:通过减少查询执行中产生的临时文件数,我们可以提高查询执行的效率。减少临时文件数是通过将多个关系操作组合成一个操作的流水线来实现的。其中一个操作的结果将传送到流水线的下一个操作。这样的执行叫做流水线执行。(见书上13.7.2.1) Steps in Heuristic Optimization (cont.) Consider the following relations in banking enterprise database, where the primary keys are underlined branch (branch-name, branch-city, assets), loan ( loan-number, branch-name , amount) borrower( customer-name, loan-number, borrow-date) customer (customer-name, customer-street, customer-city) account (account-number, branch-name, balance) depositor (customer-name, account-number , deposit-date) Example Three For the query “ Find the names of all customers who have an loan at any branch that is located in Brooklyn and have assets more than $100,000, requiring that loan-amount is less than $1000” give an SQL statement for this query given a initial query tree for the query, and convert it into an optimized query tree by means of heuristic optimization Example Three (cont.) SQL select customer-name from borrower, loan, branch where loan.loan-number=borrower.loan-number and branch.branch-name=loan.branch-name and branch-city=”Brooklyn” and assets100000 and amount1000 Example Three (cont.) ? customer-name ?loan.loan-number ? customer- name, loan-number borrower ( custome
您可能关注的文档
- 数据完整性讲述.pptx
- c++9流与文件解读.ppt
- 大数据时代下竞争情报KITKIQ分析精要.ppt
- c++_栈和队列解读.ppt
- BSC指令集解析解读.doc
- 数据实战技能培训-excel使用技能提高讲述.doc
- C++二叉树结构的建立与基本操作解读.doc
- c++作业题解读.doc
- c++6数据共享与保护静态成员与友元解读.ppt
- C++9输入输出流解读.ppt
- 中国国家标准 GB/T 18233.4-2024信息技术 用户建筑群通用布缆 第4部分:住宅.pdf
- GB/T 18233.4-2024信息技术 用户建筑群通用布缆 第4部分:住宅.pdf
- GB/T 18978.210-2024人-系统交互工效学 第210部分:以人为中心的交互系统设计.pdf
- 《GB/T 18978.210-2024人-系统交互工效学 第210部分:以人为中心的交互系统设计》.pdf
- 中国国家标准 GB/T 18978.210-2024人-系统交互工效学 第210部分:以人为中心的交互系统设计.pdf
- GB/T 16649.2-2024识别卡 集成电路卡 第2部分:带触点的卡 触点的尺寸和位置.pdf
- 《GB/T 16649.2-2024识别卡 集成电路卡 第2部分:带触点的卡 触点的尺寸和位置》.pdf
- 中国国家标准 GB/T 16649.2-2024识别卡 集成电路卡 第2部分:带触点的卡 触点的尺寸和位置.pdf
- GB/T 17889.4-2024梯子 第4部分:铰链梯.pdf
- 《GB/T 17889.4-2024梯子 第4部分:铰链梯》.pdf
文档评论(0)