Home  >  Article  >  Database  >  Oracle 有关 Consistent gets 的测试

Oracle 有关 Consistent gets 的测试

WBOY
WBOYOriginal
2016-06-07 17:20:251051browse

当我们第一次执行一条SQL语句时,Oracle 会其进行一个硬解析的操作,这个操作会额外的消耗一些资源,比如语法分析,语义分析,制

一.Consistentgets 说明

我们使用autotrace 查看执行计划和统计信息时,会显示类似如下信息: 

0  recursive calls   :递归调用。一般原因:dictionary cache未命中;动态存储扩展;PL/SQL语句

         0  db block gets   

    174530  consistent gets  

                  --db blocksgets+consistent gets= logical read

          0 physical reads    :从磁盘上读取的block数量

          0 redo size      :bytes,写到redo logs的数据量

    3546854 bytes sent via SQL*Net to client

      60244 bytes received via SQL*Net from client

       5433 SQL*Net roundtrips to/from client

          0 sorts (memory)    :内存排序次数

          0 sorts (disk)     :磁盘排序次数;与sort_area_size有关

      81467 rows processed

 

 

官网对consistent gets 的解释:

consistent gets:Number of times a consistent read wasrequested for a block.

 

    通常我们执行SQL查询时涉及的每一block都是Consistent Read, 只是有些CR(Consistent Read)需要使用undo 来进行构造, 大部分CR(Consistent Read)并不涉及到undo block的读.

      还有就是每次读这个block都是一次CR(可能每个block上有多个数据row), 也就是如果某个block被读了10次, 系统会记录10个Consistent Read.

 

简单的说:

       consistentgets : 通过不带for update的select 读的blocks.

       dbblock gets : 通过update/delete/selectfor update读的blocks.

 

db block gets + consistent gets = 整个逻辑读。

linux

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn