关于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. CentOS Kernel Source Install

    http://linuxmoz.com/centos-kernel-source-install/

  2. HDU 1226 超级密码 (搜素)

    题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1226 题意简单,本来是一道很简单的搜素题目. 但是有两个bug: 1.M个整数可能有重复的. 2.N可 ...

  3. STL之Vector(不定长数组)

    vector是同一种对象的集合,每一个对象都有一个相应的整数索引值.和string对象一样,标准库将负责管理与存储元素相关的类存. 引入头文件 #include<vector> 1.vec ...

  4. javascript它【蛇系列】第一弹:简单的蛇实现

    参考博客:http://blog.csdn.net/sunxing007/article/details/4187038 上面的博客是一个参考,竟第一次做.真让自己盲人摸象做不出来. 只是我在其上做了 ...

  5. jenkins 集成 redmine 账户验证的方案

    jenkins 集成 redmine 账户验证的方案 赖勇浩(http://laiyonghao.com) 动机 Jenkins 是最著名的持续集成工具,又因为它开源免费.插件众多,成为了许多团队做持 ...

  6. 三点半们耐热i哦好家哦i囧囧【

    http://pan.baidu.com/share/link?shareid=3011665141&uk=338692646&third=15                http ...

  7. c++ 对象指针参数和对象引用参数02

    对象指针作为函数参数和对象引用作为函数参数都比对象作为函数参数要用的更为普遍 传对象指针和传对象引用作为实参,那么实参在函数里发生了变话,那么相应的对象本身也会发生变化,二传递对象本身作为实参的话,实 ...

  8. 基于HttpClient 4.3的可訪问自签名HTTPS网站的新版工具类

    本文出处:http://blog.csdn.net/chaijunkun/article/details/40145685,转载请注明.因为本人不定期会整理相关博文,会对相应内容作出完好.因此强烈建议 ...

  9. 基于.net开发chrome核心浏览器【二】

    原文:基于.net开发chrome核心浏览器[二] 一: 上一篇的链接: 基于.net开发chrome核心浏览器[一] 二: 相关资源介绍: chrome Frame: 让IE有一颗chrome的心, ...

  10. 一个测试SQL2005数据库连接JSP档

    在这里,在SQL 2005中间InterLib数据库案例.得到InterLib/tb_booktype目录. 的影响,如下面的: watermark/2/text/aHR0cDovL2Jsb2cuY3 ...