• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

Oracle教程:select 操作产生的 redo

mysql 搞代码 4年前 (2022-01-09) 21次浏览 已收录 0个评论

数据库版本: 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
来1源gaodai#ma#com搞*代#码1网 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
—————————————————


搞代码网(gaodaima.com)提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发送到邮箱[email protected],我们会在看到邮件的第一时间内为您处理,或直接联系QQ:872152909。本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:Oracle教程:select 操作产生的 redo
喜欢 (0)
[搞代码]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址