Table does not support optimize, doing recreate + analyze instead

來源:互聯網
上載者:User

我刪除了一部分資料:

mysql> delete from pending_22 limit 1000;
Query OK, 1000 rows affected (2.99 sec)

但是delete是不會自動釋放空間的,該表資料表空間大小仍然是之前的大小:30408704

想通過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)

該表是innodb類型。

解決辦法:

mysql> alter table pending_22 engine=innodb;
Query OK, 8299 rows affected (6.63 sec)
Records: 8299  Duplicates: 0  Warnings: 0

再觀察下其資料表空間大小變成了27262976。


注意:最佳化的前提是獨立資料表空間模式(參數innodb_file_per_table為ON),否則沒有任何效果的。

對於共用資料表空間模式,想釋放磁碟空間,請參考:http://blog.csdn.net/yabingshi_tech/article/details/52274990

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.