Truncate Delete Usage

Source: Internet
Author: User

Truncate/delete Table

1, the meaning is to delete all records of the table

2, Truncate is a data definition language, the system will not write every record operation transaction log, unable to recover the record data operation

Truncate table deletes data by releasing the data page used to store the table data, and only records the page's release in the transaction log

The Delete data manipulation language stores the transaction log for each record of the operation and can recover the recorded data

3, if the table structure has the self-increment field

The trancate will start from the new increment count (for example, from 0 onwards)

Delete will not be counted from the beginning, and will be recorded from the deleted record (for example: ID self-increment (self-increment 1) Delete all records of the table 100, starting from 100 self-increment)

4, Truncate operation will be faster than delete

Trancate with less system and transaction log resources

Summary:

Which SQL Delete to use according to demand, if only to delete records do not need to restore, we recommend using truncate

Truncate Delete Usage

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.