Optimizetable error solution

Source: Internet
Author: User
A database of about 360 million queries. to improve query efficiency, optimize the database with optimizetabletable. name; a database named Tabledoesnotsupportoptimize, doingrecreate + analyzeinstead is about 360 million. to improve the query efficiency, optimize table using optimize. name; Table does not support optimize, doing recreate + analyze instead
Decisive Google, find a piece of E...

Everytime you do optimize MySQL, by using mysqlcheck-A-o or using./mysql_optimize from here.
You may see the output

Table does not support optimize, doing recreate + analyze instead.

It is because the table that you are using is InnoDB.

You can optimize the InnoDB tables by using this.

Copy codeThe code is as follows:
Alter table table. name ENGINE = 'innodb ';

This will create a copy of the original table, and drop the original table, and replace to the original place.

Although this is safe, but I suggest you do backup and test first before doing this.

It turns out that innodb databases do not support optimize and can be used.
Alter table table. name ENGINE = 'innodb ';
This method creates a new table by copying the old table and then deletes the old table. Although this process is safe, it is better to back up data before performing operations.

Another method is as follows:

You can make optimize table work on other storage engines by starting mysqld with the -- skip-new or -- safe-mode option. In this case, optimize table is just mapped toALTER TABLE.

The preceding example requires that you specify the -- skip-new or -- safe-mode option at startup to support the optimize function.

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.