mysql数据库表行数及大小查询
1. 查询elisun库下所有表各自的行数和占用磁盘大小
SELECT TABLE_NAME,TABLE_ROWS,(DATA_LENGTH+INDEX_LENGTH)/1024/1024 AS TOTAL_MB FROM information_schema.TABLES WHERE TABLE_SCHEMA='elisun' ORDER BY TABLE_ROWS DESC limit 100;
2. 查询elisun库所有表的总行数及占用磁盘的总大小
SELECT sum(TABLE_ROWS),sum((DATA_LENGTH+INDEX_LENGTH)/1024/1024) FROM information_schema.TABLES WHERE TABLE_SCHEMA='elisun';