楼主: nintyuui

[精华] [Q]性能问题!

[复制链接]
论坛徽章:
1
授权会员
日期:2005-10-30 17:05:33
31#
 楼主| 发表于 2002-10-29 09:09 | 只看该作者
重建也不行:(

使用道具 举报

回复
论坛徽章:
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
32#
发表于 2002-10-29 11:09 | 只看该作者
I am back from Beijing, your question is still outstanding ?
It seems that Oracle optimizer have changed this SQL's execution plan while you send through your applcaiton program, I have seem many time this problem happen.  The only way you can do is that, pick up the best SQL from SQL Expert with Hints specified with the following syntax to fix the execution plan, then Oracle will not change its plan during excution of your SQL statement in your application.  See, whether it works or not.  Good luck !

SELECT /*+ Hints_xxxx */ COUNT(custID) custID
FROM DW_VCustEntrust
WHERE uploaddate
BETWEEN to_date(:v1,'YYYY-MM-DD')
AND to_date(:v2,'YYYY-MM-DD')
and DW_VCustEntrust.entrustType=:v3;

使用道具 举报

回复
论坛徽章:
1
授权会员
日期:2005-10-30 17:05:33
33#
 楼主| 发表于 2002-11-1 12:59 | 只看该作者
好几天没来了。
谢谢各位的帮助,我的问题找到了解决方法,但一些具体原因及合理的或理论的支持还没有。
我和同事使用了三种方法:
编写了一段程序,模拟b/s(使用java+jdbc)
1. 使用richto的建议,改写的sql语句,问题解决。
2.在使用jdbc时不用thin改用oci8也解决同样问题。
3.sql 语句不用变量,而直接使用具体的值

但还没有调查清的问题是:
1.同样的程序,再另一台数据库中,执行没有问题(猜测是那oracle的执行策略不同)
  但为什么,到底区别再哪想弄清楚。
2.为什么我上述的第三种情况能解决问题,如果那样的话会不会带来,share pool使用率不好的问题。
3.有谁能解释一下,thin和oci8的优劣吗?或介绍文章或资料,我自己去看。

现在就想到这么多,希望各位能再帮忙解释或给个知道方向。
先谢谢大家了!:)

使用道具 举报

回复
论坛徽章:
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
34#
发表于 2002-11-1 13:14 | 只看该作者

使用变量和不使用变量带来的效率的差异

应该是由于做了 analyze 的缘故

导致了索引的选择和执行计划的差异
因为oracle分析了索引的键值,如果能直接给出 值 的话能很好的判断

如果是变量,则没有了这些信息,oracle将可能选择失误

所以这个问题和shared pool 里利用是一对矛盾
过度的使用 bind  var 有时也是有害的

使用道具 举报

回复
论坛徽章:
1
授权会员
日期:2005-10-30 17:05:33
35#
 楼主| 发表于 2002-11-1 13:35 | 只看该作者
现在我们的语句时使用程序统一生成的,
哪看来,知道等有问题的语句出现,在具体解决,
但这又有问题,在我们公司的测试数据库出现的问题,可能在用户那不出现,要么就可能调优的语句再那不是最优的。
不知道各位怎么处理这件事的。

使用道具 举报

回复
论坛徽章:
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
36#
发表于 2002-11-1 13:50 | 只看该作者

如果语句是动态生成的

可怕是不太好办

如果不利用analyze的结果
完全按照rule而不使用cost
能否有好的性能?

这样的话会简单的多
否则,除非你生成的sql的不同的个数不多
不然就麻烦了

有可能通过hints来解决问题
但,最好,你自己仔细研究sql优化,并多尝试使用sql  expert 一类的工具看看
这样才能应付各种出现的问题

使用道具 举报

回复
论坛徽章:
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
37#
发表于 2002-11-1 14:30 | 只看该作者
I can tell you this kind of problems happens anywhere, a SQL statement is runing good in one database does not mean it will be in other database, sometime even the evironment is the same.  In LECCO DB Expert, we provide a tool call Plan Version Tracker which can take SQL statements Plan Snapshot from one database and compare another Plan Snapshot from another database.  You can see the different execution plan before you physically encouter the problem, this module is especially good for porting from development database to production database.  You can event use it as database configuration checker, once you create an new index or changing any database parameter, you will find which SQL execution will be changed accordingly.

使用道具 举报

回复
论坛徽章:
4
ITPUB元老
日期:2005-02-28 12:57:00授权会员
日期:2005-10-30 17:05:33会员2006贡献徽章
日期:2006-04-17 13:46:342009新春纪念徽章
日期:2009-01-04 14:52:28
38#
发表于 2002-11-9 13:51 | 只看该作者
最初由 nintyuui 发布
[B]
1. 使用richto的建议,改写的sql语句,问题解决。
[/B]


你好,我从来没用过hint,可以讲一下你是怎样得到hint的名字的吗,还是这个名字是自己创建的

使用道具 举报

回复
论坛徽章:
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
39#
发表于 2002-11-9 16:28 | 只看该作者

你好,我从来没用过hint,可以讲一下你是怎样得到hint的名字的吗,还是这个名字是自己

你查一下文档吧

hints 都是有规则的,名字不是自己创建的

使用道具 举报

回复

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

本版积分规则 发表回复

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