Table does not support optimize, doing recreate + analyze instead

Source: Internet
Author: User

I deleted part of the data:

mysql> Delete from pending_22 limit 1000;
Query OK, 1000 rows Affected (2.99 sec)

But delete does not automatically free space, the table table space size is still before size: 30408704

To release the next space by optimize table:

mysql> optimize table pending_22; +------------------+----------+----------+-------------------------------------------------------------------+
| Table | Op | Msg_type | Msg_text |
+------------------+----------+----------+-------------------------------------------------------------------+
| np002.pending_22 | Optimize | Note | Table does not support optimize, doing recreate + analyze instead |
| np002.pending_22 | Optimize | Status | OK |
+------------------+----------+----------+-------------------------------------------------------------------+

2 rows in Set (7.49 sec)

The table is a InnoDB type.

Solution:

mysql> ALTER TABLE pending_22 ENGINE=INNODB;
Query OK, 8299 rows Affected (6.63 sec)
records:8299 duplicates:0 warnings:0

Again, the size of the table space becomes 27262976.


Note: The prerequisite for optimization is a standalone tablespace pattern (parameter innodb_file_per_table on), otherwise there is no effect.

For shared table space mode, to free up disk space, refer to: http://blog.csdn.net/yabingshi_tech/article/details/52274990

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.