The difference between delete and truncate

Source: Internet
Author: User
Delete differs from truncate:

1) Truncate is a DDL statement, and delete is a DML statement;

2) Truncate speed is much faster than delete;

The reason is that when we perform a delete operation, all table data is copied to the rollback table space first, and the amount of data varies over time. While truncate is directly deleted data does not go into the rollback table space, which results in the delete data we can run rollback for data rollback, and truncate is permanently deleted cannot rollback;

3) The truncate operation does not touch the delete trigger on the publication, and delete will trigger normally;

4) Truncate statement cannot take a where condition means that only all data can be deleted, and delete can delete some data;

5) The TRUNCATE operation resets the table's high watermark (higher water Mark), and delete does not.

The difference between delete and truncate

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.