请大家关注consistent gets db block gets

看了一天的 consistent gets db block gets 方面的资料,还是不明白这两者的的区别,特别是db block gets,我以下是我从单机上做的试验,有三个问题请高手老师们帮忙:

1 db block gets 到底指的是什么?能不能举例说明,为什么我做的以下试验的两次查询 :select count(1) from dba_objects  db block gets 始终是 0
2 为什么两次 consistent gets  不一样?

3 第二次查询为什么sorts (memory) 为 0 ,是不是第一次查询排序的结果集一直保存在db_cache buffers 中?





SQL*Plus: Release 9.2.0.1.0 - Production on 星期三 8月 6 15:32:47 2008

Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.

SQL> conn sys/sys as sysdba;
已连接到空闲例程。
SQL> startup
ORACLE 例程已经启动。

Total System Global Area  328276992 bytes
Fixed Size                   453632 bytes
Variable Size             125829120 bytes
Database Buffers          201326592 bytes
Redo Buffers                 667648 bytes
数据库装载完毕。
数据库已经打开。
SQL> conn test/test
已连接。
SQL> set autotrace on statistics;
SQL> select count(1) from dba_objects; (第一次查询)

  COUNT(1)
----------
     29512


Statistics
----------------------------------------------------------
        462  recursive calls
          0  db block gets
      22834  consistent gets
        224  physical reads
          0  redo size
        383  bytes sent via SQL*Net to client
        503  bytes received via SQL*Net from client
          2  SQL*Net roundtrips to/from client
         15  sorts (memory)
          0  sorts (disk)
          1  rows processed

SQL> select count(1) from dba_objects;(第二次查询

  COUNT(1)
----------
     29512


Statistics
----------------------------------------------------------
          0  recursive calls
          0  db block gets
      22731  consistent gets
          0  physical reads
          0  redo size
        383  bytes sent via SQL*Net to client
        503  bytes received via SQL*Net from client
          2  SQL*Net roundtrips to/from client
          0  sorts (memory)
          0  sorts (disk)
          1  rows processed

我也来说两句 查看全部回复

最新回复

  • lrmoracle (2008-8-06 16:46:02)

    老大们,帮帮忙啊!
  • Hopewell_Go (2008-8-07 17:27:42)

    第一次查询是有一部份是从物理硬盘扫描。。但是此时的结果已经放在内存里。。你可以试着清空flush shared_pool
    然后再试一下就和你第一次一样。。。