SQL statement for clearing data tables at the highest speed in MySQL

Source: Internet
Author: User
MySQL uses the SQL statement TRUNCATETABLE to quickly clear the data of a data table, so that the data table is cleared without retaining logs. Although TRUNCATETABLE is the same as a DELETE statement without WHERE, TRUNCATETABLE is faster and consumes less resources. TRUNCATETABLE does not record logs, so it cannot be excited.

MySQL uses the SQL statement TRUNCATE TABLE 'table name' to quickly clear the data of a data TABLE without retaining logs. Although the truncate table is the same as the DELETE statement without WHERE, the truncate table is faster and occupies less resources. The truncate table does not record logs, so it cannot

SQL statement for MySQL to quickly clear data in a data table


Truncate table 'table name'

In this way, the SQL statement is used to clear the data table without retaining logs.

The truncate table is the same as the DELETE statement without WHERE.
However, TRUNCATE tables are faster and occupy less resources.

The trigger cannot be activated because the truncate table does not record logs.

The truncate table cannot be used in the index view.
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.