楼主: apaches

[精华] 请教:v$sqlarea中的问题

[复制链接]
论坛徽章:
2
ITPUB元老
日期:2005-02-28 12:57:00会员2006贡献徽章
日期:2006-04-17 13:46:34
21#
发表于 2003-5-14 08:53 | 只看该作者
db block gets 是从buffer cache读取的buffer次数。
consistent gets 是从buffer cache读取buffer的old image的次数,就是说该buffer是从回滚段中读取的,因为在buffer cache中保留着block的几个版本。
两者加起来就是buffer gets

使用道具 举报

回复
论坛徽章:
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
22#
发表于 2003-5-14 09:16 | 只看该作者

最初由 fable_cao 发布
[B]db block gets 是从buffer cache读取的buffer次数。
consistent gets 是从buffer cache读取buffer的old image的次数,就是说该buffer是从回滚段中读取的,因为在buffer cache中保留着block的几个版本。
两者加起来就是buffer gets [/B]


我想在这一点上你的观点可能站不住脚
仔细研究研究再继续讨论这个问题

使用道具 举报

回复
论坛徽章:
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
23#
发表于 2003-5-14 09:23 | 只看该作者

Re: Re: 所以我认为 buffer_gets = LOGICAL IO 就可以了,不用考虑太多

最初由 Yong Huang 发布
[B]
You seem to have lost interest in whether buffer_gets (a.k.a logical reads) is in blocks or number of times. But I'll continue the research and may post you when I find the definitive answer.

Yong Huang [/B]


我目前的所有测试中都是 buffer_gets =  consistent gets + db block  gets

因为以前一直对 除了 sqlplus 的 arraysize 外还有什么能影响到 consistent gets 感到疑惑

因为假如是 open  a  cursor ,fetch  one  row
而实际上在 database 中是一次  提取出了 一批 数据(one  shot),但只返回给 client 了一条数据
这一批数据不管是真切的数据,还是一批指针,应该是保存在 PGA  中,在document 中有比较含混的描述,偶不清楚
所以借这个机会想问问

使用道具 举报

回复
论坛徽章:
26
ITPUB元老
日期:2005-02-28 12:57:00生肖徽章:兔
日期:2006-09-26 21:29:55生肖徽章:兔
日期:2006-09-07 17:01:32生肖徽章:兔
日期:2006-09-07 17:02:25生肖徽章:兔
日期:2006-09-07 17:02:46生肖徽章:兔
日期:2006-09-07 17:06:29生肖徽章:兔
日期:2006-09-18 05:26:00生肖徽章:狗
日期:2006-10-06 13:28:27生肖徽章:狗
日期:2006-10-08 05:28:34生肖徽章2007版:鸡
日期:2008-01-02 17:35:53
24#
发表于 2003-5-14 10:48 | 只看该作者
BITI:你好

不知道你用过Pro*C和OCI没有?
在Proc*C和OCI中,在open a cursor后,可以一条一条的fetch到一个变量中,也可以成批的将指定的数据行(如3000行)读到一片内存中,我想这样处理的速度可能不一样

这个处理是不是与sql*plus中的arraysize相同

这个设置与fetch数据时,取出一组数据的这个“一组”有关系吗?

或者说这个设置只与client有关,与数据库的fetch数据没有关系?

使用道具 举报

回复
论坛徽章:
26
ITPUB元老
日期:2005-02-28 12:57:00生肖徽章:兔
日期:2006-09-26 21:29:55生肖徽章:兔
日期:2006-09-07 17:01:32生肖徽章:兔
日期:2006-09-07 17:02:25生肖徽章:兔
日期:2006-09-07 17:02:46生肖徽章:兔
日期:2006-09-07 17:06:29生肖徽章:兔
日期:2006-09-18 05:26:00生肖徽章:狗
日期:2006-10-06 13:28:27生肖徽章:狗
日期:2006-10-08 05:28:34生肖徽章2007版:鸡
日期:2008-01-02 17:35:53
25#
发表于 2003-5-14 10:52 | 只看该作者
为什么arraysize的大小会影响consistent gets 的数值呢?

使用道具 举报

回复
论坛徽章:
26
ITPUB元老
日期:2005-02-28 12:57:00生肖徽章:兔
日期:2006-09-26 21:29:55生肖徽章:兔
日期:2006-09-07 17:01:32生肖徽章:兔
日期:2006-09-07 17:02:25生肖徽章:兔
日期:2006-09-07 17:02:46生肖徽章:兔
日期:2006-09-07 17:06:29生肖徽章:兔
日期:2006-09-18 05:26:00生肖徽章:狗
日期:2006-10-06 13:28:27生肖徽章:狗
日期:2006-10-08 05:28:34生肖徽章2007版:鸡
日期:2008-01-02 17:35:53
26#
发表于 2003-5-14 10:55 | 只看该作者
无论是成批ftech,还是一条ftech ,是不是不会影响SGA->磁盘的I/O呢,他们只会影响PGA----->SGA呢?

使用道具 举报

回复
论坛徽章:
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
27#
发表于 2003-5-14 11:02 | 只看该作者

跟 磁盘---> SGA 无关

这个有什么关系呢?

我也不确信 pro*c 中 成批跟 sqlplus 中 arraysize 是不是一样的本质


arraysize的大小会影响consistent gets 的数值  :因为 client 获取数据的次数发生了变化 而导致 database 中数据的获取发生变化 


 

使用道具 举报

回复
论坛徽章:
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
28#
发表于 2003-5-14 12:46 | 只看该作者
最初由 fable_cao 发布
[B]db block gets 是从buffer cache读取的buffer次数。
consistent gets 是从buffer cache读取buffer的old image的次数,就是说该buffer是从回滚段中读取的,因为在buffer cache中保留着block的几个版本。
两者加起来就是buffer gets [/B]


Consistent gets are not necessarily reads of old images. If there's no old image, it reads the current image.

The question biti_rainy and I still have open is whether the number of buffer gets is the number of times of buffer reading, or the number of buffers that are read by the process.

I'm afraid the answer is that they're both but I'm not positive. I say it's both simply because I've never heard of scattered read of multiple buffers as in the case of filesystem scatter-gather read (what readv(2) does). In other words, each read of buffers reads only one buffer, all the time, no exception, unlike db file multiblock read.

Yong Huang

使用道具 举报

回复
论坛徽章:
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
29#
发表于 2003-5-14 12:49 | 只看该作者
最初由 rchsh 发布
[B]无论是成批ftech,还是一条ftech ,是不是不会影响SGA->磁盘的I/O呢,他们只会影响PGA----->SGA呢? [/B]


I believe that's correct. Arraysize shouldn't affect disk I/O, neither number of I/Os nor number of bytes read/written.

Yong Huang

使用道具 举报

回复
论坛徽章:
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
30#
发表于 2003-5-14 13:07 | 只看该作者

the number of buffer gets is the number of times of buffer reading

SQL> select * from t;

30658 rows selected.


Execution Plan
----------------------------------------------------------
   0      SELECT STATEMENT Optimizer=CHOOSE (Cost=43 Card=30658 Bytes=
          2636588)

   1    0   TABLE ACCESS (FULL) OF 'T' (Cost=43 Card=30658 Bytes=26365
          88)





Statistics
----------------------------------------------------------
        583  recursive calls
          0  db block gets
       541  consistent gets
          0  physical reads
          0  redo size
    3343759  bytes sent via SQL*Net to client
       2090  bytes received via SQL*Net from client
         17  SQL*Net roundtrips to/from client
          6  sorts (memory)
          0  sorts (disk)
      30658  rows processed
SQL> select buffer_gets,disk_reads from v$sqlarea where sql_text like '%select * from t%';

BUFFER_GETS DISK_READS
----------- ----------
        541          0


SQL> select /*+index(t t_index)*/ * from t;

30658 rows selected.


Execution Plan
----------------------------------------------------------
   0      SELECT STATEMENT Optimizer=CHOOSE (Cost=826 Card=30658 Bytes
          =2636588)

   1    0   TABLE ACCESS (BY INDEX ROWID) OF 'T' (Cost=826 Card=30658
          Bytes=2636588)

   2    1     INDEX (FULL SCAN) OF 'T_INDEX' (NON-UNIQUE) (Cost=26 Car
          d=30658)





Statistics
----------------------------------------------------------
          0  recursive calls
          0  db block gets
      25271  consistent gets
          0  physical reads
          0  redo size
    2582261  bytes sent via SQL*Net to client
       2090  bytes received via SQL*Net from client
         17  SQL*Net roundtrips to/from client
          0  sorts (memory)
          0  sorts (disk)
      30658  rows processed

SQL> select buffer_gets,disk_reads from v$sqlarea where sql_text like '%select /*+index(t%';

BUFFER_GETS DISK_READS
----------- ----------
     25271          0

使用道具 举报

回复

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

本版积分规则 发表回复

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