Mysql 查询数据量
- [Mysql 查询数据库数据量](#Mysql 查询数据库数据量)
- Mysql查询指定数据表数据量
Mysql 查询数据库数据量
查询命令如下
sql
SELECT
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_SCHEMA = 'ei_crm'
ORDER BY
TABLE_ROWS DESC;
查询结果如图所示
Mysql查询指定数据表数据量
执行如下查询语句
sql
SELECT
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_SCHEMA = 'ei_crm'
AND TABLE_NAME LIKE 'crm_online_consultation_record%'
ORDER BY
TABLE_ROWS;
Mysql查询指定数据表数据量crm_online_consultation_record*,查询结果如图