The following table is a nologging state in archive mode and is more efficient when using/*+ append*/inserts.
Why, because it will reduce the redo and undo generation.
How do I calculate how much undo an insert produces? Before and after the insert is performed by comparing the current session
The number of undo can be known.
Connected to Oracle Database 10g Enterprise Edition Release 10.2.0.4.0
Sql> select Sid from V$mystat where Rownum=1;
Sid
----------
312
Sql> Select value "Undo Change vector Size"
2 from V$statname A, V$sesstat b
3 Where a.statistic# = b.statistic#
4 and A.name = ' undo change vector Size '
5 and B.sid = ' 312 ';
Undo Change Vector Size
-----------------------
0
Sql> CREATE table T as select RowNum from User_objects where rownum<100;
CREATE TABLE t as select RowNum from User_objects where rownum<100
Ora-00998:must name This expression with a column alias
---show rownum to specify individual names
Sql> CREATE table T as select RowNum a from user_objects where rownum<100;
Table created
Sql> Select value "Undo Change vector Size"
2 from V$statname A, V$sesstat b
3 Where a.statistic# = b.statistic#
4 and A.name = ' undo change vector Size '
5 and B.sid = ' 312 ';
Undo Change Vector Size
-----------------------
3128
sql> Insert/*+ append/into T select RowNum A from user_objects where rownum<100;
Inserted rows
Sql>
Sql> Select value "Undo Change vector Size"
2 from V$statname A, V$sesstat b
3 Where a.statistic# = b.statistic#
4 and A.name = ' undo change vector Size '
5 and B.sid = ' 312 ';
Undo Change Vector Size
-----------------------
3204
--Calculating the number of/*+ append * * * mode insert 100 records to produce undo
Sql> Select 3204-3128 d from dual;
D
----------
76
sql> INSERT INTO T-select RowNum a from user_objects where rownum<100;
Inserted rows
Sql> commit;
Commit Complete
Sql> Select value "Undo Change vector Size"
2 from V$statname A, V$sesstat b
3 Where a.statistic# = b.statistic#
4 and A.name = ' undo change vector Size '
5 and B.sid = ' 312 ';
Undo Change Vector Size
-----------------------
3920
--Calculates the number of undo produced by inserting 100 records in normal mode
Sql> Select 3920-3204 d from dual;
D
----------
716
The results show that the same record is inserted, and the undo produced by the/*+ append*/method is less.