2017-05-04 DBA日记,index表空间写入次数是table表空间写入次数的10倍之二

背景:

在前一篇文章中,我已经提到过index表空间写入次数是table表空间写入次数的10倍的原因之一是索引重建。那么是否有原因之二,原因之三呢?

分析:

我认为是有的,下面请先看看示例代码及AWR数据展示:

--create tablespace qqt and qqtinx , qqt store table data ,qqtinx store index data.
create tablespace qqt datafile '+datadg' size 12g;
create tablespace qqtinx datafile '+datadg' size 8g;

--create table for T_orders
create table hqq.T_orders tablespace qqt as select * from orders where rownum<1;

--create index for hqq.T_ORDERS
create index hqq.idx_TO_01 on hqq.so_master(no,period) tablespace qqtinx;
create index hqq.idx_TO_02 on hqq.so_master (store_no) tablespace qqtinx;

--create snapshot
truncate table hqq.T_ORDERS;
call sys.dbms_workload_repository.create_snapshot();

--initial data
insert /*+ append */ into hqq.T_Orders
select * from orders;

commit;

--create snapshot
call sys.dbms_workload_repository.create_snapshot();

awr数据:
Tablespace
------------------------------
                 Av       Av     Av               Av     Buffer  Av Buf
         Reads Reads/s  Rd(ms) Blks/Rd       Writes Writes/s      Waits  Wt(ms)
-------------- ------- ------- ------- ------------ -------- ---------- -------
QQTINX
             8       0     2.5     1.0       70,407       65          0     0.0
QQT
         1,305    1     1.3     1.0       39,939       37          0     0.0

从以上来的数据可以看出,当我将orders表全表插入T_ORDERS时,AWR中记录qqtinx的写入次数是QQT的1.8倍,由此我推断,当进行全表插入(大数量或bulk copy)时,ORACLE优化器会将多个table data block打包成一个IO请求发送到disk device上,以节省IO资源,提高IO利用率,但是为什么index block不会呢?可能与index的存储组织方式有关,不能打包发送,毕竟索引是b-tree嘛。
另外,这里又引发了一个问题,writes是否就等于io request呢? 我觉得当IO能力充足时,writes是等于io request的,反之writes会比io request大,这就说明出现io瓶颈,出现IO等待。争取在下一篇文章中完成这个问题的论证。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值