Redo size (1)

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.