Oracle empty table SQL statements and truncate and delete differences

Source: Internet
Author: User
Tags rollback oracle database

Oracle empty table SQL statements and truncate and delete differences

TRUNCATE TABLE [name]

Remove or cluster all rows from the table using the TRUNCATE statement. By default, the Oracle Database tutorial also performs the following tasks:

The only exception to deallocate is that all of the storage space used in the deleted row is specified by the minextents parameter

The next storage parameter setting cancels the last range size from the truncate portion of the process

Deleting rows with truncate statements can be more effective than dropping and recreating the table. Dropping and recreating a table's table invalid dependent object, requires you to complement the object's privileges on the table, and asks you to re-create the index, the integrity constraints, and the triggers on the table and respecify its stored parameters. Truncate had these effects without.

Deleting and Truncate statement rows can delete all rows than with the DELETE statement, especially if there are many triggers in the table, indexing and other dependencies are faster.

The difference between delete and truncate

Delete produces rollback, and if you delete a table with large amounts of data, it can be slow and take up a lot of rollback segments. Truncate is a DDL operation that does not produce rollback and 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.