MySQL 查询表碎片处理


select table_schema,concat('alter table ',table_schema,'.',table_name, ' engine=Innodb ;'),(data_length+index_length)/1024/1024 length,engine,data_free,table_rows from information_schema.tables where table_schema not in ('information_schema','mysql','performance_schema')      and data_free !=0 group by table_name order by table_rows asc;