1、MySQL查询所有后缀对应的数据表
查询数数据库tablename,查询后缀为_history的表
SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'tablename' -- 替换为你的数据库名称 AND TABLE_NAME LIKE '%_history';
2、查询数据库表大小,并排序
查询数据库mytable里面所有表,并根据数据表大小排序
SELECT table_name AS `Table`, round(((data_length + index_length) / 1024 / 1024), 2) AS `Size in MB` FROM information_schema.TABLES WHERE table_schema = 'mytable' ORDER BY (data_length + index_length) DESC;
文章评论(0)