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';

posted @ 2018-10-26 16:03  elisun  阅读(3748)  评论(0编辑  收藏  举报