12
返回列表 发新帖
楼主: SONGHEFEI

关于histograms 与 hard parse 的关系,一些迷惑!!

[复制链接]
论坛徽章:
47
蒙奇·D·路飞
日期:2017-03-27 08:04:23马上有车
日期:2014-02-18 16:41:112014年新春福章
日期:2014-02-18 16:41:11一汽
日期:2013-09-01 20:46:27复活蛋
日期:2013-03-13 07:55:232013年新春福章
日期:2013-02-25 14:51:24ITPUB 11周年纪念徽章
日期:2012-10-09 18:03:322012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:20
11#
发表于 2006-5-29 11:43 | 只看该作者
最初由 SONGHEFEI 发布
[B]Jonathan Lewis's "Cost-Based Oracle" 这本书我们没有看过,
On p.159 of his book, he says "two things will trigger this reoptimization: first, if any of the predicates involves a range scan, and second, even on a simple equality, if there is histogram on a column that appears in a predicate, the query will be reoptimized
但是我想oracle 总不会因为列上存在histograms 而每次都要create new cursor  吧?如果在高并发的情况下,对数据库系统也是一个不小的负担啊!! [/B]


I quoted that text in the context of setting cursor_sharing to similar. If cursor_sharing=similar, the behavior is the same as cursor_sharing left as the default, exact. That is, a new cursor is created for each SQL. Many developers don't know they need to use bind variables and cursor_sharing is left as default. That *is* causing performance and scalability problems.

Yong Huang

使用道具 举报

回复
论坛徽章:
2
授权会员
日期:2006-06-03 12:21:35ITPUB 11周年纪念徽章
日期:2012-10-09 18:06:20
12#
发表于 2006-5-30 07:12 | 只看该作者
ding

使用道具 举报

回复
论坛徽章:
2
授权会员
日期:2006-06-03 12:21:35ITPUB 11周年纪念徽章
日期:2012-10-09 18:06:20
13#
发表于 2006-6-2 15:39 | 只看该作者

使用道具 举报

回复
论坛徽章:
1
ITPUB新首页上线纪念徽章
日期:2007-10-20 08:38:44
14#
 楼主| 发表于 2006-6-5 21:40 | 只看该作者
前两天,数据库进行了restart ,我又做了一次测试,测试的结果与biti , Yong Huang 的结果完全相同,但是重新启动之前竟然是那个结果!真是搞不懂!而且这一次我的索引是唯一索引:
create unique index idid on test_cursor(tcid) ;
并且指定了histograms 的bucket 的数量为75,而不是auto
但是如果根据这个测试结果,如果该表存在100万行,在进行
select  * from test_cursor tc where tc.tcid=':sys_1' 的时候,每次付值不同的话,难道就要创建100万个cursor ?

使用道具 举报

回复
论坛徽章:
47
蒙奇·D·路飞
日期:2017-03-27 08:04:23马上有车
日期:2014-02-18 16:41:112014年新春福章
日期:2014-02-18 16:41:11一汽
日期:2013-09-01 20:46:27复活蛋
日期:2013-03-13 07:55:232013年新春福章
日期:2013-02-25 14:51:24ITPUB 11周年纪念徽章
日期:2012-10-09 18:03:322012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:202012新春纪念徽章
日期:2012-02-13 15:13:20
15#
发表于 2006-6-6 01:57 | 只看该作者
最初由 SONGHEFEI 发布
[B]...
如果该表存在100万行,在进行
select  * from test_cursor tc where tc.tcid=':sys_1' 的时候,每次付值不同的话,难道就要创建100万个cursor ? [/B]


According to Jonathan Lewis's and biti's research, yes, if you provide 1 million different values to tc.tcid and there's a histogram on it and cursor_sharing is similar, 1 million cursors will be created.

Yong Huang

使用道具 举报

回复
论坛徽章:
1
ITPUB新首页上线纪念徽章
日期:2007-10-20 08:38:44
16#
 楼主| 发表于 2006-6-6 09:02 | 只看该作者
最初由 Yong Huang 发布
[B]

According to Jonathan Lewis's and biti's research, yes, if you provide 1 million different values to tc.tcid and there's a histogram on it and cursor_sharing is similar, 1 million cursors will be created.

Yong Huang [/B]

所以,histograms 并不是为分布均匀的列所用的,同样在distinct value
很高的情况下,也没有必要分析histograms ,否则严重影响性能: 除了大量的hard parse 外,对shared pool 同样产生更多的小的chunk,并且在同一个bucket 下!

使用道具 举报

回复

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

本版积分规则 发表回复

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