MySQL获取Largest表TopN

获取数据库记录数/数据大小/索引大小排名前N的表

SELECT
	TABLE_SCHEMA AS '数据库',
	TABLE_NAME AS '表名',
	TABLE_ROWS AS '记录数',
	TABLE_COMMENT AS '建表说明',
	TRUNCATE ( DATA_LENGTH / 1024 / 1024, 2 ) AS '数据容量(MB)',
	TRUNCATE ( INDEX_LENGTH / 1024 / 1024, 2 ) AS '索引容量(MB)' 
FROM
	information_schema.TABLES 
WHERE
	TABLE_SCHEMA = 'meisoodev' 
ORDER BY
	TABLE_ROWS DESC 
	LIMIT 10;

本博客所有文章除特别声明外,均采用 CC BY-SA 4.0 协议 ,转载请注明出处!