oracle在执行一些DML操作时,会在block上有活动事务的标志,如果一个事务commit后,由于某些block在commit之前已经写回datafile, 或者事务影响到的block数过多,则commit的时候只会清理undo segment header中的事务标志信息,data block上的事务标志不会清除,否则代价过高。那么在一些读取这些block时,需要将这些事务标志进行清除,就是延迟块清除

实验如下:

SQL> drop table t cascade constraints;

Table dropped.
--创建一张表t
SQL> create table t as select * from dba_objects where 1=2; Table created. SQL> select count(*) from t; COUNT(*)
----------
0
--采用直接路径插入的方式,即不经过buffer cache
SQL> insert /*+ append */ into t select * from dba_objects; 87023 rows created. SQL> set autotrace on;
SQL> commit; --提交,此时新插入数据的block上的事务标志并没有清除 Commit complete. SQL> select count(*) from t; COUNT(*)
----------
87023 Execution Plan
----------------------------------------------------------
Plan hash value: 2966233522 -------------------------------------------------------------------
| Id | Operation | Name | Rows | Cost (%CPU)| Time |
-------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 339 (1)| 00:00:05 |
| 1 | SORT AGGREGATE | | 1 | | |
| 2 | TABLE ACCESS FULL| T | 67743 | 339 (1)| 00:00:05 |
------------------------------------------------------------------- Note
-----
- dynamic sampling used for this statement (level=2) Statistics
----------------------------------------------------------
0 recursive calls
1 db block gets
1249 consistent gets
1241 physical reads
168 redo size --查询即产生了redo,查询导致了data block上进行事务清除
528 bytes sent via SQL*Net to client
524 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
1 rows processed SQL> / COUNT(*)
----------
87023 Execution Plan
----------------------------------------------------------
Plan hash value: 2966233522 -------------------------------------------------------------------
| Id | Operation | Name | Rows | Cost (%CPU)| Time |
-------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 339 (1)| 00:00:05 |
| 1 | SORT AGGREGATE | | 1 | | |
| 2 | TABLE ACCESS FULL| T | 67743 | 339 (1)| 00:00:05 |
------------------------------------------------------------------- Note
-----
- dynamic sampling used for this statement (level=2) Statistics
----------------------------------------------------------
0 recursive calls
0 db block gets
1246 consistent gets
0 physical reads
0 redo size --再次查询不产生redo,事务已清除完毕
528 bytes sent via SQL*Net to client
524 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
1 rows processed SQL> truncate table t; Table truncated. SQL> select count(*) from t; COUNT(*)
----------
0 Execution Plan
----------------------------------------------------------
Plan hash value: 2966233522 -------------------------------------------------------------------
| Id | Operation | Name | Rows | Cost (%CPU)| Time |
-------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 2 (0)| 00:00:01 |
| 1 | SORT AGGREGATE | | 1 | | |
| 2 | TABLE ACCESS FULL| T | 1 | 2 (0)| 00:00:01 |
------------------------------------------------------------------- Note
-----
- dynamic sampling used for this statement (level=2) Statistics
----------------------------------------------------------
6 recursive calls
1 db block gets
13 consistent gets
0 physical reads
96 redo size --truncate表之后查询,同样也产生了延迟块清除
525 bytes sent via SQL*Net to client
524 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
1 rows processed

  

最新文章

  1. asp.net(c#) Color颜色的转换
  2. Windows 10磁盘占用100%解决办法
  3. asp.net mvc在Model中控制日期格式
  4. [转]通过继承ConfigurationSection,在web.config中增加自定义配置
  5. Wisdombud.CommonTool及其应用
  6. eclipse 汉化
  7. ecshop的广告链接地址打开有问题修改affiche.php为普通链接
  8. COB(Chip On Board)的製程簡單介紹
  9. MYSQLinsert速度过慢
  10. 手游 ui布局
  11. [转载] 详细讲解Hadoop中的简单数据库HBase
  12. JAVA WEB快速入门之从编写一个JSP WEB网站了解JSP WEB网站的基本结构、调试、部署
  13. Kubernetes 中的渐进式交付:蓝绿部署和金丝雀部署
  14. Linux上 发布.Net Core
  15. CodeForces834D DP + 线段树
  16. springboot整合activiMQ
  17. C#创建自定义Object对象
  18. 第9章 应用层(1)_域名系统DNS
  19. [vue]计算和侦听属性(computed&watch)
  20. ZT android -- 蓝牙 bluetooth (一) 入门

热门文章

  1. echarts改变颜色属性的demo
  2. ORACLE中死锁
  3. NOIP2016 天天爱跑步 - 树上差分
  4. mysql5.6+主从集的版本号(mysql5.5主机和从机载带后,5.5在设置有一定的差距)
  5. 微信小程序bnner滚动
  6. Hexo里如何添加广告
  7. @AspectJ support (good)
  8. Android中判断网络是否连接并提示设置
  9. SQLyog 报错2058 :连接 mysql 8.0.12 解决方法
  10. java 多线程以及线程池