实验

一、 自己手动创建的小表

创建一个区大小为  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_gets的理解与实验的更多相关文章

  1. 关于Jmeter线程数Ramp-Up.循环次数的理解和实验数据

    1. 关于线程组参数 线程组:即一个线程组实例里面包括多个串行的请求或动作.一个线程组的从启动到结束的时间取决于你线程中的步骤数量. 线程数:即用户数,在Ramp-up时间内(包括循环),简单把线程数 ...

  2. setInterval的简单理解和实验

    setInterval的用法 setInterval(fn_name,time_num); setInterval(fn_name,time_num,这里是函数参数); 意思是,现在不执行fn_nam ...

  3. 2分钟理解文件IO -我对文件IO的理解与实验对比

    本文介绍了不同的IO方式以及他们之间的效率比较 1.一次读取写入单个字节(读取400M的文件浪费了很久,等了很久没读取完成,证明其效率很差) public class CopyFileDemo { p ...

  4. 《深入理解计算机系统》实验三 —— Buf Lab

    这是CSAPP的第三个实验,主要让我们熟悉GDB的使用,理解程序栈帧的结构和缓冲区溢出的原理. 实验目的   本实验的目的在于加深对IA-32函数调用规则和栈结构的具体理解.实验的主要内容是对一个可执 ...

  5. 北京电子科技学院(BESTI)实验报告5

    北京电子科技学院(BESTI)实验报告5 课程: 信息安全系统设计基础 班级:1452.1453 姓名:(按贡献大小排名) 郑凯杰.周恩德 学号:(按贡献大小排名) 20145314.20145217 ...

  6. linux内核分析作业8:理解进程调度时机跟踪分析进程调度与进程切换的过程

    1. 实验目的 选择一个系统调用(13号系统调用time除外),系统调用列表,使用库函数API和C代码中嵌入汇编代码两种方式使用同一个系统调用 分析汇编代码调用系统调用的工作过程,特别是参数的传递的方 ...

  7. 20145209&20145309信息安全系统设计基础实验报告 (3)

    实验内容.步骤与体会: 实验过程的理解,实验指导书中知识点的理解. (1)为什么在双击了GIVEIO和JTAG驱动安装文件后还需要手动进行配置? 因为安装文件只是将驱动文件释放了出来,并没有在系统中将 ...

  8. Linux第三次实验报告

    北京电子科技学院(BESTI) 实     验    报     告 课程:信息安全系统设计基础             班级:201352 姓名:池彬宁 贺邦 学号:20135212 2013520 ...

  9. 信息安全系统设计基础实验一 20135210&20135218

    北京电子科技学院(BESTI) 实     验    报     告 课程: 密码系统设计基础                                                     ...

随机推荐

  1. linux-搜索

    grep显示文件中的匹配行     grep  参数  字符串  文件名 -c 输出匹配的行数 -v输出不匹配行 不加参数  :输出匹配的行 经常和管道符一起使用 eg:ps -ef|grep tom ...

  2. Telnet客户端连接服务器,看不见字符,只显示横线

    Telnet 窗口看不见字符,只显示小横线 在用telnet连接tomcat服务器的 时候,窗口中不显示字符,显示成一个一个的横线 解决办法: 按住“Ctrl+]” 回车解决问题

  3. [改善Java代码]在接口中不要存在实现代码

    第3章  类.对象及方法 书读得多而不思考,你会觉得自己知道的很多. 书读得多而思考,你会觉得自己不懂的越来越多. —伏尔泰 在面向对象编程(Object-Oriented Programming,O ...

  4. [改善Java代码]慎用动态编译

    建议17: 慎用动态编译 //=========这篇博文暂时理解不透......... 动态编译一直是Java的梦想,从Java 6版本它开始支持动态编译了,可以在运行期直接编译.java文件,执行. ...

  5. 【概率dp,难度3颗星】hdu-5001(2014鞍山网络赛)

    给你一个连通的无向图,等概率随机选取一个起点,走d步,每一步等概率走到相邻的点.问走完d步之后,每个点没有被经过的概率. 推状态的关键当然就是对这个“从任意起点走完d步点node没被经过的概率”的理解 ...

  6. HDU 1003 - Max Sum(难度:*)

    Problem Description Given a sequence a[1],a[2],a[3]......a[n], your job is to calculate the max sum ...

  7. hdu 1892 树状数组

    思路:就是一个很普通的二维树状数组,注意的是x1,y1不一定在x2,y2的左下方. #include<iostream> #include<cstring> #include& ...

  8. poj 3678 2-SAT问题

    思路:将每个点拆分为两个点 a与a' ,a表示为1,a'表示为0.那么条件给的每个边自然就会存在矛盾,然后根据2-SAT建边就行了. #include<iostream> #include ...

  9. 轻松学习Ionic (四) 修改应用图标及添加启动画面(更新官方命令行工具自动生成)

    由于Ionic更新了命令行工具,以后修改应用图标和添加启动画面就简单了,最新方法见最下方:   应用图标:   1.在整个项目所在文件夹下创建res文件夹,里边再分别创建两个文件夹android和io ...

  10. 今天用css做了一个QQ登录页面

    <!doctype html> <html> <head> <meta charset="utf-8"> <title> ...