首页 > 数据库 > MySQL > optimize table
SELECT table_name, data_free * 100 / data_length , data_free, data_length FROM information_schema.TABLES WHERE table_schema='dbschemename'
Some delete often table will have much fragments, if it's too high and the table data is not too much, could defragment. For INNODB table does not need to do defragment (optimize table)
ALTER TABLE zm_meeting_history engine=innodb will not block DML
these two still block DML: Waiting for table metadata lock,
ALTER TABLE zm_meeting_history FORCE
OPTIMIZE TABLE zm_meeting_history
this problem may depends on data, first ALTER TABLE `zm_polling` FORCE, ALGORITHM=INPLACE, LOCK=NONE not work
after delete ALTER TABLE zm_polling DROP INDEX meeting_number still not work
then readd ALTER TABLE zm_polling ADD INDEX meeting_number(meeting_number), it could, confused how data will impact this?
meeting_number is bigint
answer:
Upgrade to 5.6.27 or later
http://www.xaprb.com/blog/2010/02/07/how-often-should-you-use-optimize-table/
https://www.percona.com/blog/2010/12/09/mysql-optimize-tables-innodb-stop/
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/545828/viewspace-2101457/ ,如需转载,请注明出处,否则将追究法律责任。