查看某个数据库的数据量 和索引量的大小
- SELECT
- SUM(DATA_LENGTH)/ 1024 / 1024 + SUM(INDEX_LENGTH)/ 1024 / 1024
- FROM
- information_schema. TABLES
- WHERE
- TABLE_SCHEMA = 'ice_produce_cn';
伦理片 http://www.dotdy.com/
查看索引量的大小
- SELECT
- SUM(INDEX_LENGTH)/ 1024 / 1024
- FROM
- information_schema. TABLES
- WHERE
- TABLE_SCHEMA = 'ice_produce_cn';
查看数据量排名前100的表
- select TABLE_NAME,DATA_LENGTH/ 1024 / 1024,TABLE_ROWS,ENGINE from information_schema.TABLES
- WHERE TABLE_SCHEMA = 'ice_produce_cn' order by DATA_LENGTH desc limit 100;
查看索引数据排名前100的表
- SELECT
- TABLE_NAME,
- (DATA_LENGTH / 1024 / 1024) ,
- (INDEX_LENGTH / 1024 / 1024) ,
- TABLE_ROWS,
- ENGINE
- FROM
- information_schema.TABLES
- WHERE
- TABLE_SCHEMA = 'ice_produce_cn'
- ORDER BY
- DATA_LENGTH DESC,
- INDEX_LENGTH DESC
- LIMIT 100;