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

请教11G的新特性嵌套循环,谢谢

[复制链接]
论坛徽章:
2
2013年新春福章
日期:2013-02-25 14:51:24优秀写手
日期:2014-04-05 06:00:00
11#
 楼主| 发表于 2013-2-23 11:13 | 只看该作者
本帖最后由 earth2mars 于 2013-2-23 11:54 编辑
Yong Huang 发表于 2013-2-23 01:47
> 如何证明10G和11G一样也是有一个中间结果(含有全部的ROWID)?

I don't have a proof. I basically too ...

1. "If "中间结果做为驱动行源的", then T has to be 遍历 more than once. Isn't that going to have a much higher cost than 遍历 once?"
==================================================================================
怎么会遍历多次呢?不需要遍历啊,比如中间结果是 2个ROWIDs,那么只要 ROWID SCAN T两次就可以了啊
如果 T表 1000万行,遍历一次T表,到中间结果查询1000万次?想想也不合理啊!10G会这么做?我觉得是不可能的事情
11G难道不是中间结果的ROWIDs作为驱动行源的吗?
而且10G执行计划里的 TABLE ACCESS BY INDEX ROWID 也说明是了最后一步 对T表的访问是ROWID 扫描
这里问题的焦点在于,读一遍是怎样读一遍?全表扫描一遍?这个完全不可能的,
既然是 TABLE ACCESS BY INDEX ROWID,怎么理解读一遍呢?


2.  有一个问题是,那本书里提到的旧机制和新机制,并没有涉及到11G,因为出版那本书的时候,11G还没有发布
书上提到的新机制是10G的


3.  所以11G的所谓 VECTOR I/O到底是怎么回事?不理解
   我觉得OTN上我给出的链接的那两个执行计划,是没有差别的,除非11G的TABLE ACCESS BY INDEX ROWID 能实现 单次I/O多块读,并且10G是单次I/O单块读,那就有差别了



使用道具 举报

回复
论坛徽章:
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
12#
发表于 2013-2-23 13:06 | 只看该作者
本帖最后由 Yong Huang 于 2013-2-22 23:19 编辑

> 不需要遍历啊,比如中间结果是 2个ROWIDs,那么只要 ROWID SCAN T两次就可以了啊

You're absolutely right! I forgot that the interim result is actually a set of ROWID's. (If it was regular row data, then it would scan the table T multiple times.) And you're right: we can think of the interim result as the driver. Note that Oracle probably thinks that because the ROWID's are pre-sorted, table T only needs to be scanned once, therefore Execs=1 on line 1 for the 10g plan. But interestingly, although the nature of the acccess to table T remains the same, the 11g plan accounting assigns 5 to Execs instead of 1.

> 11G的所谓 VECTOR I/O到底是怎么回事?

If the 11g "table access by index rowid" in the new NLJ uses vector I/O, that will be very interesting. I just tested with my small data set. I still see db file sequential read event for table T (using the new 11g plan). Maybe I need to check the underlying OS system call with e.g. strace on Linux and see readv() calls, instead of relying on the Oracle wait event.

使用道具 举报

回复
论坛徽章:
2
2013年新春福章
日期:2013-02-25 14:51:24优秀写手
日期:2014-04-05 06:00:00
13#
 楼主| 发表于 2013-2-23 18:38 | 只看该作者
Yong Huang 发表于 2013-2-23 13:06
> 不需要遍历啊,比如中间结果是 2个ROWIDs,那么只要 ROWID SCAN T两次就可以了啊

You're absolutely r ...

sql monitor 显示10G 的TABLE ACCESS BY INDEX ROWID 1次
而11G 5次,确实不理解

我想来想去都不明白11G比10G好在哪里,我觉得这两个执行计划是一样的
除非11G的 TABLE ACCES BY INDEX ROWID 是实现的多块读。

另外,11G对于每个块只会读一次,10G在Lewis那么书上所说,貌似每个数据块也只会读一次
我实在不清楚10G 和11g有什么区别了

VECTOR I/O 太玄乎了

使用道具 举报

回复
论坛徽章:
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
14#
发表于 2013-2-24 08:57 | 只看该作者
> sql monitor 显示10G 的TABLE ACCESS BY INDEX ROWID 1次
> 而11G 5次,确实不理解

Literally, we can read it like this. In 10g, table T is read once because after the first read, a pointer pointing to the row just read stays there. When the second read occurs, the pointer moves down by some row ID's to point to the second row. In 11g, each read is independent. There's no "memory" or "remembering" of the read position of the previous read. So 10g's Execs is 1 and 11g's is 5.

> VECTOR I/O 太玄乎了

When I have time, I'll test it and report back.

使用道具 举报

回复
论坛徽章:
2
2013年新春福章
日期:2013-02-25 14:51:24优秀写手
日期:2014-04-05 06:00:00
15#
 楼主| 发表于 2013-2-24 09:57 | 只看该作者
本帖最后由 earth2mars 于 2013-2-24 10:11 编辑
Yong Huang 发表于 2013-2-24 08:57
> sql monitor 显示10G 的TABLE ACCESS BY INDEX ROWID 1次
> 而11G 5次,确实不理解


Literally, we can read it like this. In 10g, table T is read once because after the first read, a pointer pointing to the row just read stays there. When the second read occurs, the pointer moves down by some row ID's to point to the second row. In 11g, each read is independent. There's no "memory" or "remembering" of the read position of the previous read. So 10g's Execs is 1 and 11g's is 5.
===============================================================
这个是你猜的吧,我也曾这么猜想过,但是我找不到任何官方文档说明,也没法用实验证明
如果是那样,10G是不是只有一次 I/O ? 而11G有5次 I/O ?
那11G的优越性如何体现?
我不清楚 Execs指的是否I/O的次数,如果是I/O的次数,那么应该10G快才对啊
如果是执行“TABLE ACCESS BY INDEX TOWID”的次数 也不对,因为11G执行了5次,10G执行了1次


使用道具 举报

回复

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

本版积分规则 发表回复

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