楼主: olive

[精华] 如何解决不同SQL之间的性能冲突?

[复制链接]
论坛徽章:
95
秀才
日期:2015-10-08 17:57:58法拉利
日期:2013-12-30 15:11:23问答徽章
日期:2013-12-26 12:24:32优秀写手
日期:2013-12-18 09:29:13本田
日期:2013-12-09 10:02:28兰博基尼
日期:2013-11-18 17:44:52宝马
日期:2013-11-06 11:34:13雪佛兰
日期:2013-11-01 18:36:15宝马
日期:2013-10-25 08:22:20路虎
日期:2014-01-20 14:09:03
71#
 楼主| 发表于 2002-4-29 17:06 | 只看该作者
但是这种招数可能也只有电脑能想出来,人脑是很难想出来的。
虽然电脑的思想也是人脑赋予的,呵呵。

使用道具 举报

回复
论坛徽章:
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
72#
发表于 2002-4-29 17:18 | 只看该作者
Database optimizer cannot solve every problem for you, so human tuning is necessary, that is why database vendor are more open to user to influence their database optimizer.  If you cannot tuning your SQL statement, you can download a copy of SQL Expert from LECCOTECH.COM to see whether it can help you or not.
Remark: Cost-based approach can solve some problems but create another problems as well, that is why Oracle don't turn it on by default !

使用道具 举报

回复
论坛徽章:
86
ITPUB元老
日期:2005-02-28 12:57:002012新春纪念徽章
日期:2012-01-04 11:49:542012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:20咸鸭蛋
日期:2012-05-08 10:27:19版主8段
日期:2012-05-15 15:24:112013年新春福章
日期:2013-02-25 14:51:24
73#
发表于 2002-4-29 17:37 | 只看该作者

hehe

怎么说曹操曹操就到啊
olive你就请教richto吧
他就是sql expert 的开发者
去LECCOTECH.COM ,他可能能帮你解决问题  :)

使用道具 举报

回复
论坛徽章:
3
ITPUB元老
日期:2005-02-28 12:57:00授权会员
日期:2005-10-30 17:05:33会员2006贡献徽章
日期:2006-04-17 13:46:34
74#
发表于 2002-4-29 17:42 | 只看该作者

Re: hehe

原来richto是高手高手高高高高高高手

最初由 biti_rainy 发布
[B]怎么说曹操曹操就到啊
olive你就请教richto吧
他就是sql expert 的开发者
去LECCOTECH.COM ,他可能能帮你解决问题  :) [/B]

使用道具 举报

回复
论坛徽章:
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
75#
发表于 2002-4-29 17:44 | 只看该作者
Sorry, I just look at the first page and made my comment.  I am the Hong Kong guy, but I am not that old as what your guys described.  I am so busy in these few months, if not our friend told me, I am still don't know your guys are using our product to solve your problem, I am happy my product can help you to solve your problems, no matter your guys are using an illegal copy or not.   I am developing a new product call DB Expert V3, which not only improves optimization power, but recommends indexes as well.  A new Plan Version Tracker will help you to predict what SQL’s performance will be changed before database upgrade, migration, building new indexes, analyze statistics, etc.   I will let your guys knows more after I finish the development.

The A+0 or A||’’ is try to disable the index search for a predicates.  It makes Oracle Optimizer to pick up another execution plan.  Some SQL transformation will be executed in a recursive manner, that is why it eats up a lot of space and CPU, but is worth to do so, instead doing it by human. Your time should be used on more productive task! Right?

使用道具 举报

回复
论坛徽章:
95
秀才
日期:2015-10-08 17:57:58法拉利
日期:2013-12-30 15:11:23问答徽章
日期:2013-12-26 12:24:32优秀写手
日期:2013-12-18 09:29:13本田
日期:2013-12-09 10:02:28兰博基尼
日期:2013-11-18 17:44:52宝马
日期:2013-11-06 11:34:13雪佛兰
日期:2013-11-01 18:36:15宝马
日期:2013-10-25 08:22:20路虎
日期:2014-01-20 14:09:03
76#
 楼主| 发表于 2002-4-29 18:16 | 只看该作者

Great!

I never thought my post could get so many feedbacks...
In fact, for the second run started this afternoon, I set rules search quota to 2000, hints quota ratio to 100, and table join permutation quota to 4000. It's now at 93%, seeming to be stuck because it has been quite a long time, but the memory usage is still growing so I think it's running. CPU occupation on my PC is low, but high on the server (about 50%).
Anyway I will keep it running. The only thing I worry is that the PC memory may overflow. It's now 350M and my limit is 500M...
If it fails eventually, either I will increase the virtual memory, or I will decrease the quota.
So keep your eyes on the post...

使用道具 举报

回复
论坛徽章:
95
秀才
日期:2015-10-08 17:57:58法拉利
日期:2013-12-30 15:11:23问答徽章
日期:2013-12-26 12:24:32优秀写手
日期:2013-12-18 09:29:13本田
日期:2013-12-09 10:02:28兰博基尼
日期:2013-11-18 17:44:52宝马
日期:2013-11-06 11:34:13雪佛兰
日期:2013-11-01 18:36:15宝马
日期:2013-10-25 08:22:20路虎
日期:2014-01-20 14:09:03
77#
 楼主| 发表于 2002-4-29 18:25 | 只看该作者

One more thing to richto

I must clarify that I am using a legal copy of SQL EXPERT...
It's the trial version downloaded from the official web site... I hope I can get a good result before it expires...
So if you can tailor a special 'ITPUB Edition' for us... )

使用道具 举报

回复
论坛徽章:
3
授权会员
日期:2005-10-30 17:05:33ITPUB十周年纪念徽章
日期:2011-11-01 16:19:412012新春纪念徽章
日期:2012-01-04 11:49:54
78#
发表于 2002-4-29 18:30 | 只看该作者

Re: Great!

最初由 olive 发布
[B]I never thought my post could get so many feedbacks...
In fact, for the second run started this afternoon, I set rules search quota to 2000, hints quota ratio to 100, and table join permutation quota to 4000. It's now at 93%, seeming to be stuck because it has been quite a long time, but the memory usage is still growing so I think it's running. CPU occupation on my PC is low, but high on the server (about 50%).
Anyway I will keep it running. The only thing I worry is that the PC memory may overflow. It's now 350M and my limit is 500M...
If it fails eventually, either I will increase the virtual memory, or I will decrease the quota.
So keep your eyes on the post... [/B]


这时候在向Server逐条拿plan进行比较,所以Local的CPU使用率不高,此时主要看Server的速度了.500M真不知道是否够, 我想看下你最终能得到多少种等效的写法

使用道具 举报

回复
论坛徽章:
95
秀才
日期:2015-10-08 17:57:58法拉利
日期:2013-12-30 15:11:23问答徽章
日期:2013-12-26 12:24:32优秀写手
日期:2013-12-18 09:29:13本田
日期:2013-12-09 10:02:28兰博基尼
日期:2013-11-18 17:44:52宝马
日期:2013-11-06 11:34:13雪佛兰
日期:2013-11-01 18:36:15宝马
日期:2013-10-25 08:22:20路虎
日期:2014-01-20 14:09:03
79#
 楼主| 发表于 2002-4-29 18:52 | 只看该作者

It's now 94% :)

After hours of wait it progresses 1%...
And the memory occupation is now 420M...

To be or not to be, this is a question ...

使用道具 举报

回复
论坛徽章:
95
秀才
日期:2015-10-08 17:57:58法拉利
日期:2013-12-30 15:11:23问答徽章
日期:2013-12-26 12:24:32优秀写手
日期:2013-12-18 09:29:13本田
日期:2013-12-09 10:02:28兰博基尼
日期:2013-11-18 17:44:52宝马
日期:2013-11-06 11:34:13雪佛兰
日期:2013-11-01 18:36:15宝马
日期:2013-10-25 08:22:20路虎
日期:2014-01-20 14:09:03
80#
 楼主| 发表于 2002-4-29 19:52 | 只看该作者

Finished Optimizing

终于在内存溢出之前做完优化了,好紧张...最后内存停留在危险的450M左右。值得一说的是在最后几个百分点的时候,总的内存占用不升反降,但是硬盘很忙。
结果在这里:
22000 Semantically equivalent SQL statement(s) investigated.
2753 Alternative execution plan(s) produced.
[19247 SQL statement(s) eliminated due to identical execution plan]
Note:
To accurately identify the best performing SQL use the Batch Run function.
Warning:
Total Hints Quota 20000 reached.
Table Join Permutation Quota 4000 reached.

所以现在要跑这2700多个语句了... 时间打算设成35秒。预计30个小时...

还有还有,我变成老会员了,果然是在战斗中成长,哈哈...

使用道具 举报

回复

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

本版积分规则 发表回复

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