关于db_block_gets了解和实验

实验

一、 自己手动创建的小表

创建一个区大小为  40k 

SYS@ORCL>show parameter db_block_size





NAME                                 TYPE        VALUE

------------------------------------ ----------- ------------------------------

db_block_size                        integer    





SYS@ORCL>create tablespace tyger1 datafile '/u01/app/oracle/oradata/ORCL/tyger1.dbf' size 10m

  2  extent management local uniform size 40k;





Tablespace created.





SYS@ORCL>create table test_db1(x int) tablespace tyger1;





Table created.





SYS@ORCL>set autotrace on 

SYS@ORCL>insert into test_db1 values(1);





1 row created.









Execution Plan

----------------------------------------------------------





-------------------------------------------------------------------------

| Id  | Operation        | Name | Rows  | Bytes | Cost (%CPU)| Time     |

-------------------------------------------------------------------------

|   0 | INSERT STATEMENT |      |     1 |   100 |     1   (0)| 00:00:01 |

-------------------------------------------------------------------------









Statistics

----------------------------------------------------------

          1  recursive calls

         19  db block gets

          1  consistent gets

          3  physical reads

        964  redo size

        675  bytes sent via SQL*Net to client

        562  bytes received via SQL*Net from client

          4  SQL*Net roundtrips to/from client

          1  sorts (memory)

          0  sorts (disk)

          1  rows processed





SYS@ORCL>insert into test_db1 values(2);





1 row created.









Execution Plan

----------------------------------------------------------





-------------------------------------------------------------------------

| Id  | Operation        | Name | Rows  | Bytes | Cost (%CPU)| Time     |

-------------------------------------------------------------------------

|   0 | INSERT STATEMENT |      |     1 |   100 |     1   (0)| 00:00:01 |

-------------------------------------------------------------------------









Statistics

----------------------------------------------------------

          1  recursive calls

          3  db block gets

          1  consistent gets

          0  physical reads

        244  redo size

        675  bytes sent via SQL*Net to client

        562  bytes received via SQL*Net from client

          4  SQL*Net roundtrips to/from client

          1  sorts (memory)

          0  sorts (disk)

          1  rows processed









2. 创建一个区 大小为80k

SYS@ORCL>create tablespace tyger2 datafile '/u01/app/oracle/oradata/ORCL/tyger2.dbf' size 10m

  2  extent management local uniform size 80k;





Tablespace created.





SYS@ORCL>create table test_db2(x int) tablespace tyger2;





Table created.





SYS@ORCL>insert into test_db2 values(1);





1 row created.









Execution Plan

----------------------------------------------------------





-------------------------------------------------------------------------

| Id  | Operation        | Name | Rows  | Bytes | Cost (%CPU)| Time     |

-------------------------------------------------------------------------

|   0 | INSERT STATEMENT |      |     1 |   100 |     1   (0)| 00:00:01 |

-------------------------------------------------------------------------









Statistics

----------------------------------------------------------

          1  recursive calls

         29  db block gets

          1  consistent gets

         28  physical reads

       1364  redo size

        675  bytes sent via SQL*Net to client

        562  bytes received via SQL*Net from client

          4  SQL*Net roundtrips to/from client

          1  sorts (memory)

          0  sorts (disk)

          1  rows processed





SYS@ORCL>insert into test_db2 values(2);





1 row created.









Execution Plan

----------------------------------------------------------





-------------------------------------------------------------------------

| Id  | Operation        | Name | Rows  | Bytes | Cost (%CPU)| Time     |

-------------------------------------------------------------------------

|   0 | INSERT STATEMENT |      |     1 |   100 |     1   (0)| 00:00:01 |

-------------------------------------------------------------------------









Statistics

----------------------------------------------------------

          1  recursive calls

          3  db block gets

          1  consistent gets

          0  physical reads

        288  redo size

        677  bytes sent via SQL*Net to client

        562  bytes received via SQL*Net from client

          4  SQL*Net roundtrips to/from client

          1  sorts (memory)

          0  sorts (disk)

          1  rows processed

结论:对于新创建的表来说。由于创建的是空表就没有对表里的空间进行分配,当插入第一条数据时,就须要对区上的块进行空间分配和对数据字典的一些操作,就会有比較大的db_block_size。

假设再次插入数据的话就基本没有对空间的分配啥的,就会有比較少的db_block_size产生。

所以对于extent指定的区大小来说  相同的空表插入相同的数据 db_block_size 可能不同。

对插入更新、删除的实验:

SYS@ORCL>update test_db1 set x=3 where x=1;





1 row updated.









Execution Plan

----------------------------------------------------------

Plan hash value: 2185639234





-------------------------------------------------------------------------------

| Id  | Operation          | Name     | Rows  | Bytes | Cost (%CPU)| Time     |

-------------------------------------------------------------------------------

|   0 | UPDATE STATEMENT   |          |     1 |    13 |     2   (0)| 00:00:01 |

|   1 |  UPDATE            | TEST_DB1 |       |       |            |          |

|*  2 |   TABLE ACCESS FULL| TEST_DB1 |     1 |    13 |     2   (0)| 00:00:01 |

-------------------------------------------------------------------------------





Predicate Information (identified by operation id):

---------------------------------------------------





   2 - filter("X"=1)





Note

-----

   - dynamic sampling used for this statement









Statistics

----------------------------------------------------------

         28  recursive calls

          1  db block gets

         11  consistent gets

          0  physical reads

        388  redo size

        678  bytes sent via SQL*Net to client

        565  bytes received via SQL*Net from client

          4  SQL*Net roundtrips to/from client

          1  sorts (memory)

          0  sorts (disk)

          1  rows processed





SYS@ORCL>delete test_db1 where x=2;





1 row deleted.









Execution Plan

----------------------------------------------------------

Plan hash value: 3135214910





-------------------------------------------------------------------------------

| Id  | Operation          | Name     | Rows  | Bytes | Cost (%CPU)| Time     |

-------------------------------------------------------------------------------

|   0 | DELETE STATEMENT   |          |     1 |    13 |     2   (0)| 00:00:01 |

|   1 |  DELETE            | TEST_DB1 |       |       |            |          |

|*  2 |   TABLE ACCESS FULL| TEST_DB1 |     1 |    13 |     2   (0)| 00:00:01 |

-------------------------------------------------------------------------------





Predicate Information (identified by operation id):

---------------------------------------------------





   2 - filter("X"=2)





Note

-----

   - dynamic sampling used for this statement









Statistics

----------------------------------------------------------

          5  recursive calls

          1  db block gets

          9  consistent gets

          0  physical reads

        288  redo size

        678  bytes sent via SQL*Net to client

        557  bytes received via SQL*Net from client

          4  SQL*Net roundtrips to/from client

          1  sorts (memory)

          0  sorts (disk)

          1  rows processed





SYS@ORCL>insert into test_db1 values(&x);

Enter value for x: 1

old   1: insert into test_db1 values(&x)

new   1: insert into test_db1 values(1)





1 row created.





。。。。

SYS@ORCL>commit;





Commit complete.





SYS@ORCL>select * from test_db1;





         X

----------

         3

         1

         2

         3

         4

         5

         6

         7

         8

         9

        19

        10

         1

        11

        12

        13

        14

        15

        16

        17

        18





21 rows selected.







SYS@ORCL>alter system flush buffer_cache;





System altered.

SYS@ORCL>update test_db1 set x=21 where x=18;





1 row updated.









Execution Plan

----------------------------------------------------------

Plan hash value: 2185639234





-------------------------------------------------------------------------------

| Id  | Operation          | Name     | Rows  | Bytes | Cost (%CPU)| Time     |

-------------------------------------------------------------------------------

|   0 | UPDATE STATEMENT   |          |     1 |    13 |     2   (0)| 00:00:01 |

|   1 |  UPDATE            | TEST_DB1 |       |       |            |          |

|*  2 |   TABLE ACCESS FULL| TEST_DB1 |     1 |    13 |     2   (0)| 00:00:01 |

-------------------------------------------------------------------------------





Predicate Information (identified by operation id):

---------------------------------------------------





   2 - filter("X"=18)





Note

-----

   - dynamic sampling used for this statement









Statistics

----------------------------------------------------------

          5  recursive calls

          1  db block gets

          9  consistent gets

          0  physical reads

        412  redo size

        678  bytes sent via SQL*Net to client

        567  bytes received via SQL*Net from client

          4  SQL*Net roundtrips to/from client

          1  sorts (memory)

          0  sorts (disk)

          1  rows processed

二、对于比較大的表来说

SYS@ORCL>create table test_db1 as select * from dba_objects;





Table created.

 

 

SYS@ORCL>insert into test_db1 values('tyger','tyger','tyger',22,23,'tyger','04-SEP-14','04-SEP-14','tyger','t','t','t','t');





1 row created.









Execution Plan

----------------------------------------------------------





-------------------------------------------------------------------------

| Id  | Operation        | Name | Rows  | Bytes | Cost (%CPU)| Time     |

-------------------------------------------------------------------------

|   0 | INSERT STATEMENT |      |     1 |   100 |     1   (0)| 00:00:01 |

-------------------------------------------------------------------------









Statistics

----------------------------------------------------------

          1  recursive calls

         15  db block gets

          1  consistent gets

          5  physical reads

       1144  redo size

        677  bytes sent via SQL*Net to client

        646  bytes received via SQL*Net from client

          4  SQL*Net roundtrips to/from client

          1  sorts (memory)

          0  sorts (disk)

          1  rows processed





 

 

SYS@ORCL>alter system flush buffer_cache;





System altered.





SYS@ORCL>update test_db1 set OBJECT_NAME='tom' where owner='tyger';





3 rows updated.









Execution Plan

----------------------------------------------------------

Plan hash value: 2185639234





-------------------------------------------------------------------------------

| Id  | Operation          | Name     | Rows  | Bytes | Cost (%CPU)| Time     |

-------------------------------------------------------------------------------

|   0 | UPDATE STATEMENT   |          |     8 |   664 |   154   (2)| 00:00:02 |

|   1 |  UPDATE            | TEST_DB1 |       |       |            |          |

|*  2 |   TABLE ACCESS FULL| TEST_DB1 |     8 |   664 |   154   (2)| 00:00:02 |

-------------------------------------------------------------------------------





Predicate Information (identified by operation id):

---------------------------------------------------





   2 - filter("OWNER"='tyger')





Note

-----

   - dynamic sampling used for this statement









Statistics

----------------------------------------------------------

          5  recursive calls

          3  db block gets

        769  consistent gets

        687  physical reads

        824  redo size

        679  bytes sent via SQL*Net to client

        589  bytes received via SQL*Net from client

          4  SQL*Net roundtrips to/from client

          1  sorts (memory)

          0  sorts (disk)

          3  rows processed

SYS@ORCL>delete test_db1 where owner='tyger';





3 rows deleted.









Execution Plan

----------------------------------------------------------

Plan hash value: 3135214910





-------------------------------------------------------------------------------

| Id  | Operation          | Name     | Rows  | Bytes | Cost (%CPU)| Time     |

-------------------------------------------------------------------------------

|   0 | DELETE STATEMENT   |          |     8 |   136 |   154   (2)| 00:00:02 |

|   1 |  DELETE            | TEST_DB1 |       |       |            |          |

|*  2 |   TABLE ACCESS FULL| TEST_DB1 |     8 |   136 |   154   (2)| 00:00:02 |

-------------------------------------------------------------------------------





Predicate Information (identified by operation id):

---------------------------------------------------





   2 - filter("OWNER"='tyger')





Note

-----

   - dynamic sampling used for this statement









Statistics

----------------------------------------------------------

          4  recursive calls

          3  db block gets

        769  consistent gets

          0  physical reads

       1064  redo size

        679  bytes sent via SQL*Net to client

        567  bytes received via SQL*Net from client

          4  SQL*Net roundtrips to/from client

          1  sorts (memory)

          0  sorts (disk)

          3  rows processed

结论:对于占用多个段的大表来说。可能对数据改动时 对 数据字典  或者对于区、块的分配都包括在 physical reads中。

感想:

对于生产库来说,这个值一般不会太考虑究竟数字是怎么来的,由于数字都比较大,通常只关心它的尺寸大小。

版权声明:本文博主原创文章。博客,未经同意不得转载。

左右db_block_size了解和实验的更多相关文章

  1. 关于对db_block_gets的理解与实验

    实验 一. 自己手动创建的小表 创建一个区大小为  40k  SYS@ORCL>show parameter db_block_size NAME                         ...

  2. 模拟生产搭建Standby RAC实验环境(11.2.0.4 DG)

    模拟生产搭建Standby RAC实验环境(11.2.0.4 DG) 环境:RHEL 6.5 + Oracle 11.2.0.4 GI.DB 1.需求背景介绍 2.准备工作 3.主库配置 4.备库配置 ...

  3. [原] 利用 OVS 建立 VxLAN 虚拟网络实验

    OVS 配置 VxLAN HOST A ------------------------------------------ | zh-veth0(10.1.1.1) VM A | | ---|--- ...

  4. Android中Activity的四大启动模式实验简述

    作为Android四大组件之一,Activity可以说是最基本也是最常见的组件,它提供了一个显示界面,从而实现与用户的交互,作为初学者,必须熟练掌握.今天我们就来通过实验演示,来帮助大家理解Activ ...

  5. SEED实验系列文章目录

    美国雪城大学SEEDLabs实验列表 SEEDLabs是一套完整的信息安全实验,涵盖本科信息安全教学中的大部分基本原理.项目组2002年由杜文亮教授创建,目前开发了30个实验,几百所大学已采用.实验楼 ...

  6. 物联网实验4 alljoyn物联网实验之手机局域网控制设备

    AllJoyn开源物联网协议框架,官方描述是一个能够使连接设备之间进行互操作的通用软件框架和系统服务核心集,也是一个跨制造商来创建动态近端网络的软件应用.高通已经将该项目捐赠给了一个名为“AllSee ...

  7. (转)linux下和云端通讯的例程, ubuntu和openwrt实验成功(一)

    一.  HTTP请求的数据流总结#上传数据, yeelink的数据流如下POST /v1.0/device/4420/sensor/9089/datapoints HTTP/1.1Host: api. ...

  8. (原创) alljoyn物联网实验之手机局域网控制设备

    AllJoyn开源物联网协议框架,官方描述是一个能够使连接设备之间进行互操作的通用软件框架和系统服务核心集,也是一个跨制造商来创建动态近端网络的软件应用.高通已经将该项目捐赠给了一个名为“AllSee ...

  9. 实验:Oracle直接拷贝物理存储文件迁移

    实验目的:Oracle直接拷贝物理文件迁移,生产库有类似施工需求,故在实验环境简单验证一下. 实验环境: A主机:192.168.1.200 Solaris10 + Oracle 11.2.0.1 B ...

随机推荐

  1. no copy constructor available or copy constructor is declared 'explicit'

    今天新写了一个类.然后对这个类使用STL中的vector,碰到错误: no copy constructor available or copy constructor is declared 'ex ...

  2. Centos 6安装完美搭建mysql、php、apache之旅

    安装apache [root@centos share]# yum -y install httpd Loaded plugins: fastestmirror, refresh-packagekit ...

  3. POJ 1018 【枚举+剪枝】.cpp

    题意: 给出n个工厂的产品参数带宽b和价格p,在这n个工厂里分别选1件产品共n件,使B/P最小,其中B表示n件产品中最小的b值,P表示n件产品p值的和. 输入 iCase n 表示iCase个样例n个 ...

  4. CentOS 6.5 配置 SSDB 1.8.0

    环境说明: OS:CentOS 6.5  (阿里云ECS) 相关链接: 1.SSDB 下载配置:http://ssdb.io/docs/install.html 2.SSDB 入门文档:http:// ...

  5. 在Apache上架设SVN使得可以通过http来使用SVN

    弄了一下午,终于搞定了.找到一篇好的博客.分享出来: 宇哥搞了个论坛网站,我的svn使用不了了,我把svn重新架设到apache后,又可以通过http访问svn了. .安装 Apache http:/ ...

  6. WebGL自学教程——WebGL演示样例:開始

    最终開始WebGL的演示样例了,...... 開始 使用WebGL的步骤,非常easy: 1. 获得WebGL的渲染环境(也叫渲染上下文). 2. 发挥你的想象力,利用<WebGL參考手冊> ...

  7. net平台下连接池

    http://www.cnblogs.com/visionwang/archive/2012/11/16/2774203.html net平台下连接池概述 ADO.NET已经为我们提供这样的连接池管理 ...

  8. thinkphp框架相关研究(一)

    小编最近开始正式研究thinkphp框架,在此写下研究的整个历程,从最最基本的搭建网站开始,一步步记录.希望对大家有所帮助. 1.菜鸟从下载框架到建站 参考网址:http://blog.csdn.ne ...

  9. 消息队列(Message Queue)基本概念(转)

    背景 之前做日志收集模块时,用到flume.另外也有的方案,集成kafaka来提升系统可扩展性,其中涉及到消息队列当时自己并不清楚为什么要使用消息队列.而在我自己提出的原始日志采集方案中不适用消息队列 ...

  10. cocos2d-html5游戏图片资源选择

    cocos2d-html5游戏图片资源能够选择,单张的图片作为一个精灵或者场景的载入对象.也能够把图片给做成plist文件.通过plist来訪问图片资源.其中优缺点.使用方式在个人的測试其中体现例如以 ...