查看分区表及数据大于500W的表

查看数据大于等于500W的表
SELECT
table_schema AS '数据库',
table_name AS '表名',
table_rows AS '记录数',
TRUNCATE(data_length/1024/1024, 2) AS '数据容量(MB)',
TRUNCATE(index_length/1024/1024, 2) AS '索引容量(MB)'
FROM information_schema.tables
WHERE table_rows >= 5000000
ORDER BY data_length DESC, index_length DESC;
查看是否分区表
SELECT
table_schema AS '数据库',
table_name AS '表名',
table_rows AS '记录数',
TRUNCATE(data_length/1024/1024, 2) AS '数据容量(MB)',
TRUNCATE(index_length/1024/1024, 2) AS '索引容量(MB)'
FROM information_schema.tables
WHERE table_name = '表名'
ORDER BY data_length DESC, index_length DESC;

你可能感兴趣的:(查看分区表及数据大于500W的表)