数据库版本: oracle database 10g enterprise edition release 10.1.0.3.0 创建测试表:sqlgt; create table a as select * f
数据库版本:
oracle database 10g enterprise edition release 10.1.0.3.0
创建测试表:
sql> create table a as select * from all_objects ;
table created.
sql> set autotrace on statistics ;
插入数据(hint append):
sql> insert /*+ append */ into a select * from all_objects ;
9891 rows created.
statistics
----------------------------------------------------------
302 recursive calls
137 db block gets
6040 consistent gets
0 physical reads
1055332 redo size
627 bytes sent via sql*net to client
558 bytes received via sql*net from client
3 sql*net roundtrips to/from client
1 sorts (memory)
0 sorts (disk)
9891 rows processed
sql> commit ;
commit complete.
第一次查询数据:
sql> select count(*) from a ;
count(*)
----------
19782
statistics
----------------------------------------------------------
0 recursive calls
1 db block gets
255 consistent gets
248 physical reads
168 redo size---------------------------------> ???产生redo??? 395 bytes sent via sql*net to client
507 bytes received via sql*net from client
2 sql*net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
1 rows processed
第二次查询:
sql> select count(*) from a ;
count(*)
----------
19782
statistics
----------------------------------------------------------
0 recursive calls
0 db block gets
252 consistent gets
1 physical reads
0 redo size
395 bytes sent via sql*net to client
507 bytes received via sql*net from client
2 sql*net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
1 rows processed
=================================================
如上所示,为什么在查询的时候会产生 redo ? 产生的redo 到底是做什么的?
=================================================
----
取消 hint append 插入数据,第一次查询不会产生redo
sql> insert into a select * from a ;
19782 rows created.
statistics
----------------------------------------------------------
112 recursive calls
21100 db block gets
699 consistent gets
0 physical reads
7149196 redo size
642 bytes sent via sql*net to client
534 bytes received via sql*net from client
3 sql*net roundtrips to/from client
1 sorts (memory)
0 sorts (disk)
19782 rows processed
sql>
sql>
sql> select count(*) from a ;
count(*)
----------
39564
statistics
----------------------------------------------------------
0 recursive calls
0 db block gets
502 consistent gets
0 physical reads
0 redo size 395 bytes sent via sql*net to client
507 bytes received via sql*net from client
2 sql*net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
1 rows processed
---------------------------------------------------