It is always very easy to resign, so today I am doing a 1z0-042 question bank. The correct answer is that truncate can generate a small number of redo operations, let me test it.
Step 1 create a table
1 Create TableTestAs Select * FromDba_objects;
Step 2: Calculate the redosize
SelectName, ValueFromV $ sysstatWhereA. Name= 'Redo size';
Redo size: 32378840.
Step 3 truncate the table and then count the redo size
Truncate TableTest1;
The current redo size is 32423748.
We can see that the redo size has increased by 44908.
Step 4 Delete the table, rebuild it according to the above rules, and redo size is recorded.
1 Drop TableTest1;
2 Create TableTest1As Select * FromDba_objects;
3 SelectName, ValueFromV $ sysstatWhereA. Name= 'Redo size';
The current redo size is 32737804.
Step 5 delete the file in a common way and redo size:
1 Delete FromTest1;
2 Commit;--Commit itself does not generate redo
3 SelectName, ValueFromV $ sysstatWhereA. Name= 'Redo size';
The current redo size is 59415540.
Subtract from the number of previous records: 26677736.
It can be seen that the advantage of using truncate is that a very small amount of redo can be generated, so the deletion speed is theoretically higher than that of Delete. Before this experiment, we cleared a 3G data table as required by Party A. At that time, due to lack of understanding of truncate, we thought it would take a long time, therefore, I was ready to leave my computer in the office for a night, but I did not expect to blink of an eye, so the table was cleared. Unfortunately, no redo size changes were recorded at that time, otherwise, it is a good example.
This is the first article. I will study SQL and redo in the future.