查询数据库表大小、表索引大小、表行数sql
select a.`table_schema` ,a.`table_name` ,a.`table_comment`, truncate(a.`data_length`/1024/1024, 2) as `data_length`, truncate(a.`index_length`/1024/1024, 2) as `index_length`, a.`table_rows` tableRows from information_schema.tables a right join dfs_config_cleanable_table b on a.`table_name` = b.`table_name` where table_schema= 'test_permission' #and a.`table_name` like concat('%',{tableName},'%') #and a.`table_comment` like concat('%',{tableComment},'%') order by a.`data_length` desc, a.`index_length` desc
优化数据库碎片
optimize TABLE ${tableName}