Mysql optimization table and repair table command instructions (REPAIRTABLE and OPTIMIZETAB)

Source: Internet
Author: User
With the long-term use of mysql, some problems may occur. In general, mysql tables cannot be accessed, and the tables can be repaired. During optimization, the disk space is reduced. Convenient backup.

With the long-term use of mysql, some problems may occur. In general, mysql tables cannot be accessed, and the tables can be repaired. During optimization, the disk space is reduced. Convenient backup.

The Code is as follows:
Repair table 'table _ name' REPAIR table
Optimize table 'table _ name' OPTIMIZE table

Repair table is used to REPAIR damaged tables.
Optimize table is used to recycle idle database space. When the data rows in the TABLE are deleted, the occupied disk space is not immediately recycled, after the optimize table command is used, the space will be recycled and the data rows on the disk will be rearranged (Note: it is on the disk rather than the database ).

Optimize table does not need to be run most of the time. You only need to perform a data TABLE optimization operation after batch deletion of data rows, or regularly (once a week or once a month), only for those specific tables.

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.