Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> consistent gets not equal to number of rows

consistent gets not equal to number of rows

From: <bdurrettccci_at_yahoo.com>
Date: 1 Feb 2007 12:26:45 -0800
Message-ID: <1170361605.628702.69330@v45g2000cwv.googlegroups.com>


I've been puzzling over the "consistent gets" number that comes out of sqlplus when you set autotrace on. I understand consistent gets to be the most common type of logical read. But, the number of consistent gets appears to equal the number of blocks accessed by a query and not the number of rows. So, it would seem that Oracle batches up accesses to rows by block. Or it just counts the first access to a block by the query as a consistent get and doesn't count subsequent accesses. Anyway, if you can shed more light on the subject or refer to an article, book, manual, etc. that explains it that would be great.

Here is an example:

create table test as select rownum A from dba_objects;

execute dbms_stats.gather_table_stats('','TEST');

select num_rows,blocks from user_tables where table_name='TEST';

  NUM_ROWS BLOCKS
---------- ----------

    100049 153

set autotrace on statistics

select sum(A) from test;

Statistics


          1  recursive calls
          0  db block gets
        157  consistent gets
        154  physical reads
          0  redo size
        413  bytes sent via SQL*Net to client
        396  bytes received via SQL*Net from client
          2  SQL*Net roundtrips to/from client
          0  sorts (memory)
          0  sorts (disk)
          1  rows processed

So, my question is why does consistent gets equal 157, approximately the number of blocks, and not 100049, the number of rows?

Thanks,
Bobby Received on Thu Feb 01 2007 - 14:26:45 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US