Document Type | Technical Information
Category | Migration
Applicable Product Versions | T6, T7
Document Number | TMITI038
Overview
This test is conducted to check the amount of Redo generated depending on the presence or absence of the Append hint during Insert operations, in order to reduce the load in the production environment.
Method
Test Scenario
ALL_OBJECTS data is loaded into the test table while changing the table's LOGGING option and the APPEND hint respectively, performing INSERT operations and checking the amount of Redo generated. Additionally, the test is executed identically in both NOARCHIVELOG mode and ARCHIVELOG mode to compare the results.
Creating the Test Table
CREATE TABLE TEST_TABLE AS
SELECT *
FROM ALL_OBJECTS
WHERE 1 = 0;Data Insert Test
The following INSERT queries are executed in both NOARCHIVELOG mode and ARCHIVELOG mode respectively to compare the amount of Redo generated.
Table logging, without using append hint
ALTER TABLE TEST_TABLE LOGGING;
INSERT INTO TEST_TABLE
SELECT * FROM ALL_OBJECTS;
Table logging, using append hint
TRUNCATE TABLE TEST_TABLE;
ALTER TABLE TEST_TABLE LOGGING;
INSERT /*+ APPEND */ INTO TEST_TABLE
SELECT * FROM ALL_OBJECTS;
Table nologging, using append hint
TRUNCATE TABLE TEST_TABLE;
ALTER TABLE TEST_TABLE NOLOGGING;
INSERT /*+ APPEND */ INTO TEST_TABLE
SELECT * FROM ALL_OBJECTS;
Table nologging, without using append hint
TRUNCATE TABLE TEST_TABLE;
ALTER TABLE TEST_TABLE NOLOGGING;
INSERT INTO TEST_TABLE
SELECT * FROM ALL_OBJECTS;
Test Results
-- Query to measure redo generation
select * from v$sysstat where name like 'redo log size';| Condition | Redo Generation | |
| NOARCHIVELOG MODE | ARCHIVELOG MODE | |
| Table logging, without append hint | 164886 | 164918 |
| Table logging, using append hint | 5948 | 177584 |
| Table no logging, without append hint | 164886 | 164886 |
| Table no logging, using append hint | 6036 | 5948 |
Conclusion
NOARCHIVELOGmode recommends using theAPPENDhint duringINSERTto reduce Redo generation.ARCHIVELOGmode recommends changing the table toNOLOGGINGand using theAPPENDhint together.However, note that the
INSERT INTO ... VALUESsyntax does not support theAPPENDhint, so caution is required when applying it.