4 SQL*Net roundtrips to/from client
2 sorts (memory)
0 sorts (disk)
980 rows processed
SQL> rollback;
回退已完成。
SQL> insert into t select * from user_tables;
已创建980行。
统计信息
----------------------------------------------------------
0 recursive calls
144 db block gets
9027 consistent gets
0 physical reads
267448 redo size
927 bytes sent via SQL*Net to client
1004 bytes received via SQL*Net from client
4 SQL*Net roundtrips to/from client
2 sorts (memory)
0 sorts (disk)
980 rows processed
Nologging模式下示例:
SQL> alter table t nologging;
表已更改。
SQL> insert into t select * from user_tables;
已创建980行。
统计信息
----------------------------------------------------------
239 recursive calls
132 db block gets
9061 consistent gets
0 physical reads
262896 redo size
927 bytes sent via SQL*Net to client
1004 bytes received via SQL*Net from client
4 SQL*Net roundtrips to/from client
7 sorts (memory)
0 sorts (disk)
980 rows processed
SQL> rollback;
回退已完成。
SQL> insert /*+append */ into t select * from user_tables;
已创建980行。
统计信息
----------------------------------------------------------
8 recursive calls
40 db block gets
8938 consistent gets
0 physical reads
340 redo size -- redo 减少很多
911 bytes sent via SQL*Net to client
1017 bytes received via SQL*Net from client
4 SQL*Net roundtrips to/from client
2 sorts (memory)
0 sorts (disk)
980 rows processed
7.2 直接加载和索引
如果直接加载的表上有索引,Oracle不会像加载数据的方式那样来处理索引的数据,但是它同样需要维护一个索引,这个成本很高,同时会生成很多的redo。
所以当使用直接加载时,通常是针对一些数据量非常大的表。如果这些表存在索引,将会带来很大的性能影响,这时可以考虑先将索引disable或者drop掉,等加载数据后,之后在重新建立索引。
nologging示例:
SQL> insert /*+append */ into t select * from user_tables;
已创建980行。
统计信息
----------------------------------------------------------
0 recursive calls
40 db block gets
8936 consistent gets
0 physical reads
384 redo size
911 bytes sent via SQL*Net to client
1017 bytes received via SQL*Net from client
4 SQL*Net roundtrips to/from client
2 sorts (memory)
0 sorts (disk)
980 rows processed
SQL> rollback;
回退已完成。
SQL> create index t_ind on t(table_name);
索引已创建。
SQL> insert /*+append */ into t select * from user_tables;
已创建980行。
统计信息
----------------------------------------------------------
40 recursive calls
170 db block gets
8955 consistent gets
4 physical reads
149424 redo size
911 bytes sent via SQL*Net to client
1017 bytes received via SQL*Net from client
4 SQL*Net roundtrips to/from client
3 sorts (memory)
0 sorts (disk)
980 rows processed
SQL> rollback;
回退已完成。
SQL> insert into t select * from user_tables;
已创建980行。
统计信息
----------------------------------------------------------