123
返回列表 发新帖

有个纠结的问题

[复制链接]
论坛徽章:
20
ITPUB元老
日期:2005-02-28 12:57:002012新春纪念徽章
日期:2012-02-13 15:10:582012新春纪念徽章
日期:2012-02-13 15:10:582012新春纪念徽章
日期:2012-02-13 15:10:582012新春纪念徽章
日期:2012-02-13 15:10:58马上有车
日期:2014-02-19 11:55:14马上有房
日期:2014-02-19 11:55:14马上有钱
日期:2014-02-19 11:55:14马上有对象
日期:2014-02-19 11:55:142012新春纪念徽章
日期:2012-02-13 15:10:58
21#
发表于 2017-12-14 10:28 | 只看该作者
newkid 发表于 2017-12-13 23:25
是的,但是有的SQL跑一下都要几十分钟,所以硬解析期间是不可能一一尝试的。ORACLE自己也做出一些努力比 ...

Oracle using cardinality feedback, adaptive plan and SQL plan directives to fix the execution plan selection. But it is still rely on cost estimation.  The cost estimation is theoretically impossible to be 100% correct. It is why Oracle is always have room to improve. A lot of cost estimation factors are based on assumption only and cannot fit different environments.
My tool is simple, test run all effective Hints combination for your SQL and find the best one in your environment.  You can download one from https://tosska.com/tosska-sql-tuning-expert-tse-oracle/
and give it a test and see whether it is worth to have one.  The first 30 alternatives SQL is for free.

使用道具 举报

回复
论坛徽章:
520
奥运会纪念徽章:垒球
日期:2008-09-15 01:28:12生肖徽章2007版:鸡
日期:2008-11-17 23:40:58生肖徽章2007版:马
日期:2008-11-18 05:09:48数据库板块每日发贴之星
日期:2008-11-29 01:01:02数据库板块每日发贴之星
日期:2008-12-05 01:01:03生肖徽章2007版:虎
日期:2008-12-10 07:47:462009新春纪念徽章
日期:2009-01-04 14:52:28数据库板块每日发贴之星
日期:2009-02-08 01:01:03生肖徽章2007版:蛇
日期:2009-03-09 22:18:532009日食纪念
日期:2009-07-22 09:30:00
22#
发表于 2017-12-14 23:04 | 只看该作者
richto 发表于 2017-12-14 10:28
Oracle using cardinality feedback, adaptive plan and SQL plan directives to fix the execution plan ...

这个不是很准确,cardinality feedback和 adaptive plan 都是会收集真正执行的结果的,并不是基于估计,而正是为了纠正估计值。
Oracle自己的evolve sql plan baseline, sql tuning advisor 等都是会真正去执行不同计划并且进行比较、选择的,也都是为了纠正它自己的估计误差。当然这些都是要耗费资源的。你的工具有什么优势?假设一个SQL执行要60分钟,你的优化过程大约要几分钟?

使用道具 举报

回复
论坛徽章:
20
ITPUB元老
日期:2005-02-28 12:57:002012新春纪念徽章
日期:2012-02-13 15:10:582012新春纪念徽章
日期:2012-02-13 15:10:582012新春纪念徽章
日期:2012-02-13 15:10:582012新春纪念徽章
日期:2012-02-13 15:10:58马上有车
日期:2014-02-19 11:55:14马上有房
日期:2014-02-19 11:55:14马上有钱
日期:2014-02-19 11:55:14马上有对象
日期:2014-02-19 11:55:142012新春纪念徽章
日期:2012-02-13 15:10:58
23#
发表于 2017-12-15 11:52 | 只看该作者
newkid 发表于 2017-12-14 23:04
这个不是很准确,cardinality feedback和 adaptive plan 都是会收集真正执行的结果的,并不是基于估计, ...

Cardinality feedback is good for similar plans with same execution steps, if the plan is different, the new plan steps cardinalities are still estimated figures only. For example; if Plan1 has actual cardinality collected, it does not mean you know Plan2 actual cost. plan2 has some execution steps that not exists in Plan1.

If you want to tune a SQL with original execution time 60 minutes, and you know it is not reasonable and you want to save your time of using Tosska SQLL Tuning Expert, you can set a user define time to terminate all SQL alternatives that run longer than this user defined time.  For example, you expect your SQL can run and finish within 20 minutes, you can set 20 minutes as the termination time. So, the whole test run will speed up.

使用道具 举报

回复
论坛徽章:
520
奥运会纪念徽章:垒球
日期:2008-09-15 01:28:12生肖徽章2007版:鸡
日期:2008-11-17 23:40:58生肖徽章2007版:马
日期:2008-11-18 05:09:48数据库板块每日发贴之星
日期:2008-11-29 01:01:02数据库板块每日发贴之星
日期:2008-12-05 01:01:03生肖徽章2007版:虎
日期:2008-12-10 07:47:462009新春纪念徽章
日期:2009-01-04 14:52:28数据库板块每日发贴之星
日期:2009-02-08 01:01:03生肖徽章2007版:蛇
日期:2009-03-09 22:18:532009日食纪念
日期:2009-07-22 09:30:00
24#
发表于 2017-12-16 00:03 | 只看该作者
这个feedback功能有点类似于bind peeking, 它当然不可能每次都去窥视的,所以有时候plan2还更差,我们在实际中也多次碰到过。
不知道你的工具总共尝试几种hints? 即使仅仅是连接顺序、连接方式、数据访问路径(全表或索引),这些组合起来也十分可观,这也是为什么CBO不可能穷尽其组合,那么你又是如何取舍的呢?很多时候计划劣化是因为CBO不掌握数据的特征,比如相关列之类的。你这个工具有没有试图建立自己的知识库,又是怎么收集的?

使用道具 举报

回复
论坛徽章:
20
ITPUB元老
日期:2005-02-28 12:57:002012新春纪念徽章
日期:2012-02-13 15:10:582012新春纪念徽章
日期:2012-02-13 15:10:582012新春纪念徽章
日期:2012-02-13 15:10:582012新春纪念徽章
日期:2012-02-13 15:10:58马上有车
日期:2014-02-19 11:55:14马上有房
日期:2014-02-19 11:55:14马上有钱
日期:2014-02-19 11:55:14马上有对象
日期:2014-02-19 11:55:142012新春纪念徽章
日期:2012-02-13 15:10:58
25#
发表于 2017-12-18 16:19 | 只看该作者
newkid 发表于 2017-12-16 00:03
这个feedback功能有点类似于bind peeking, 它当然不可能每次都去窥视的,所以有时候plan2还更差,我们在实 ...

You are very good. There are more than 100 hints in Oracle. If we pick 3 out of 100, the permutation will be up to a million.  So, we will use most possible hints to your SQL with a patent pending algorithm.
Actually, SQL cost estimation problems are more than what you guys can imagine. We can discuss more later in this forum.

使用道具 举报

回复

您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

TOP技术积分榜 社区积分榜 徽章 团队 统计 知识索引树 积分竞拍 文本模式 帮助
  ITPUB首页 | ITPUB论坛 | 数据库技术 | 企业信息化 | 开发技术 | 微软技术 | 软件工程与项目管理 | IBM技术园地 | 行业纵向讨论 | IT招聘 | IT文档
  ChinaUnix | ChinaUnix博客 | ChinaUnix论坛
CopyRight 1999-2011 itpub.net All Right Reserved. 北京盛拓优讯信息技术有限公司版权所有 联系我们 未成年人举报专区 
京ICP备16024965号-8  北京市公安局海淀分局网监中心备案编号:11010802021510 广播电视节目制作经营许可证:编号(京)字第1149号
  
快速回复 返回顶部 返回列表