通過添加hint加速insert操作

EODA@PROD1> select count(*) from sys.tt;

  COUNT(*)
----------
    480000

Elapsed: 00:00:01.15

EODA@PROD1> create table t_ins as select * from sys.tt where 0=1;

Table created.

Elapsed: 00:00:00.07
EODA@PROD1> create table t_ins_nolog as select * from sys.tt where 0=1;

Table created.

Elapsed: 00:00:00.07

EODA@PROD1> alter table t_ins_nolog nologging;

Table altered.

Elapsed: 00:00:00.03

EODA@PROD1> insert into t_ins select * from sys.tt;

480000 rows created.

Elapsed: 00:00:06.77

Statistics
----------------------------------------------------------
	  0  recursive calls
      42716  db block gets
      16934  consistent gets
	257  physical reads
   46494940  redo size   --46494940
	922  bytes sent via SQL*Net to client
       1006  bytes received via SQL*Net from client
	  4  SQL*Net roundtrips to/from client
	  1  sorts (memory)
	  0  sorts (disk)
     480000  rows processed
	 
EODA@PROD1> insert /*+append*/ into t_ins_nolog select * from sys.tt;

480000 rows created.

Elapsed: 00:00:00.23  

Statistics
----------------------------------------------------------
	  0  recursive calls
       5908  db block gets
       5678  consistent gets
       5670  physical reads
      10348  redo size  --10348
	907  bytes sent via SQL*Net to client
       1024  bytes received via SQL*Net from client
	  4  SQL*Net roundtrips to/from client
	  1  sorts (memory)
	  0  sorts (disk)
     480000  rows processed

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章