Oracle Clearing table SQL statement and difference between Truncate and delete

Source: Internet
Author: User

The difference between delete and truncate: delete generates rollback. If you delete a table with a large amount of data, it will take up a lot of rollback segments. truncate is a DDL operation and does not generate rollback, which is faster.

Oracle Clearing table SQL statement and difference between truncate and delete

Truncate table [table name]

Use the truncate statement to delete all rows from the table or the cluster. By default, the oracle database tutorial also performs the following tasks:

The only exception to unallocation is that all buckets used in the deleted row are specified by minextents.

The truncate part of the process set for the next storage parameter cancels the final range size.

Deleting and truncate statement rows can be more effective than dropping and recreating a table. Dropping and re-creating an invalid dependent object for a table requires you to add the Object Privilege on the table and require you to re-create the index, integrity constraints, and store parameters in the triggers and respecify tables. Truncate has no such impact.

Deleting and truncate statement rows can be faster than deleting all rows using the delete statement, especially if there are many triggers in the table, indexing and other dependencies.

Differences between delete and truncate

Delete generates rollback. If you delete a table with a large amount of data, it takes up a lot of rollback segments. truncate is a ddl operation and does not generate rollback, which is faster.
*/

Related Article

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.