No, it is NOT incorrect.
What is incorrect?
Append rebuilds the indexes at the end -- with logging. You want to do it without -- do it my way.
Read the example, it clearly shows
A) there is a difference
B) there is a big difference
Regardless of the number of times I do the append -- i don't care, its going to be a large difference. Look:
ops$tkyte@ORA717DEV.US.ORACLE.COM> variable start number
ops$tkyte@ORA717DEV.US.ORACLE.COM>
ops$tkyte@ORA717DEV.US.ORACLE.COM> create table t as select * from all_objects;
Table created.
ops$tkyte@ORA717DEV.US.ORACLE.COM> insert /*+ append */ into t select * from all_objects;
ops$tkyte@ORA717DEV.US.ORACLE.COM> commit;
ops$tkyte@ORA717DEV.US.ORACLE.COM> insert /*+ append */ into t select * from all_objects;
ops$tkyte@ORA717DEV.US.ORACLE.COM> commit;
ops$tkyte@ORA717DEV.US.ORACLE.COM> insert /*+ append */ into t select * from all_objects;
ops$tkyte@ORA717DEV.US.ORACLE.COM> commit;
ops$tkyte@ORA717DEV.US.ORACLE.COM> create table t1 as select * from all_objects where 1=0;
Table created.
ops$tkyte@ORA717DEV.US.ORACLE.COM> create index t1_idx1 on t1(object_name);
Index created.
ops$tkyte@ORA717DEV.US.ORACLE.COM> create index t1_idx2 on t1(object_id);
Index created.
ops$tkyte@ORA717DEV.US.ORACLE.COM> create table t2 as select * from all_objects where 1=0;
Table created.
ops$tkyte@ORA717DEV.US.ORACLE.COM> create index t2_idx1 on t2(object_name);
Index created.
ops$tkyte@ORA717DEV.US.ORACLE.COM> create index t2_idx2 on t2(object_id);
Index created.
ops$tkyte@ORA717DEV.US.ORACLE.COM> column value new_val V
ops$tkyte@ORA717DEV.US.ORACLE.COM> select a.name, b.value
2 from v$statname a, v$mystat b
3 where a.statistic# = b.statistic#
4 and a.name = 'redo size'
5 and b.value > 0
6 /
NAME VALUE
------------------------------ ----------
redo size 964432
ops$tkyte@ORA717DEV.US.ORACLE.COM> exec :start := dbms_utility.get_time;
PL/SQL procedure successfully completed.
ops$tkyte@ORA717DEV.US.ORACLE.COM> alter index t1_idx1 unusable;
Index altered.
ops$tkyte@ORA717DEV.US.ORACLE.COM> alter index t1_idx2 unusable;
Index altered.
ops$tkyte@ORA717DEV.US.ORACLE.COM> alter session set skip_unusable_indexes=true;
Session altered.
ops$tkyte@ORA717DEV.US.ORACLE.COM> set autotrace on statistics
ops$tkyte@ORA717DEV.US.ORACLE.COM> insert /*+ append */ into t1 select * from t;
67932 rows created.
Statistics
----------------------------------------------------------
3914 recursive calls
568 db block gets
2661 consistent gets
928 physical reads
70988 redo size
998 bytes sent via SQL*Net to client
825 bytes received via SQL*Net from client
4 SQL*Net roundtrips to/from client
9 sorts (memory)
0 sorts (disk)
67932 rows processed
ops$tkyte@ORA717DEV.US.ORACLE.COM> set autotrace off
ops$tkyte@ORA717DEV.US.ORACLE.COM> alter index t1_idx1 rebuild nologging;
Index altered.
ops$tkyte@ORA717DEV.US.ORACLE.COM> alter index t1_idx2 rebuild nologging;
Index altered.
ops$tkyte@ORA717DEV.US.ORACLE.COM> exec dbms_output.put_line( (dbms_utility.get_time-:start) || ' hsecs' );<b>
1366 hsecs</b>
PL/SQL procedure successfully completed.
ops$tkyte@ORA717DEV.US.ORACLE.COM> select a.name, b.value-&V delta_redo_size
2 from v$statname a, v$mystat b
3 where a.statistic# = b.statistic#
4 and a.name = 'redo size'
5 and b.value > 0
6 /
old 1: select a.name, b.value-&V delta_redo_size
new 1: select a.name, b.value- 964432 delta_redo_size
NAME DELTA_REDO_SIZE
------------------------------ ---------------<b>
redo size 171708</b>
ops$tkyte@ORA717DEV.US.ORACLE.COM> select a.name, b.value
2 from v$statname a, v$mystat b
3 where a.statistic# = b.statistic#
4 and a.name = 'redo size'
5 and b.value > 0
6 /
NAME VALUE
------------------------------ ----------
redo size 1136140
ops$tkyte@ORA717DEV.US.ORACLE.COM> exec :start := dbms_utility.get_time;
PL/SQL procedure successfully completed.
ops$tkyte@ORA717DEV.US.ORACLE.COM> set autotrace on statistics
ops$tkyte@ORA717DEV.US.ORACLE.COM> insert /*+ append */ into t2 select * from t;
67932 rows created.
Statistics
----------------------------------------------------------
7386 recursive calls
11266 db block gets
5028 consistent gets
2214 physical reads<b>
14820480 redo size</b>
999 bytes sent via SQL*Net to client
825 bytes received via SQL*Net from client
4 SQL*Net roundtrips to/from client
3 sorts (memory)
2 sorts (disk)
67932 rows processed
ops$tkyte@ORA717DEV.US.ORACLE.COM> set autotrace off
ops$tkyte@ORA717DEV.US.ORACLE.COM> exec dbms_output.put_line( (dbms_utility.get_time-:start) || ' hsecs' );<b>
2888 hsecs</b>
PL/SQL procedure successfully completed.
ops$tkyte@ORA717DEV.US.ORACLE.COM> select a.name, b.value-&V delta_redo_size
2 from v$statname a, v$mystat b
3 where a.statistic# = b.statistic#
4 and a.name = 'redo size'
5 and b.value > 0
6 /
old 1: select a.name, b.value-&V delta_redo_size
new 1: select a.name, b.value- 1136140 delta_redo_size
NAME DELTA_REDO_SIZE
------------------------------ ---------------<b>
redo size 14820480</b>
171k versus 14m, 13 sec vs 28 sec. One big insert only (same number of rows), same relative amount of time (it was 2x faster above in the original example, it is still 2x faster in this new example -- only each individual example is faster cause I did it as a single statement).
So, comparision correct, valid and OK.