摘要:
下文讲述MySQL查看指定数据库下的数据表大小的方法分享,如下所示:
实现思路:
查看数据库下表大小,我们通常通过查询 information_schema 系统表 tables,来获取数据表信息的方法
方法1:tables
select table_name,table_rows,data_length+index_length,
concat(round((data_length+index_length)/1024/1024,2),'MB')
data from tables ;
---查询maomao 数据库下的所有表大小
select table_name,table_rows,data_length+index_length,
concat(round((data_length+index_length)/1024/1024,2),'MB')
data from tables where table_schema='maomao';
方法2:使用describe tables命令获取
use information_schema;
describe tables;
/*
--输出列说明---
TABLE_SCHEMA:数据库名称
TABLE_NAME:数据表名名称
TABLE_ROWS:数据表行数
DATA_LENGTH:数据表大小
INDEX_LENGTH:数据表索引大小
*/
本文介绍了两种在MySQL中查看指定数据库下数据表大小的方法。第一种是通过查询information_schema系统的tables表,展示表名、行数、数据大小及索引大小,并以MB为单位。第二种方法是使用describetables命令,获取数据库名称、表名、行数、数据表大小和索引大小等信息。

9528

被折叠的 条评论
为什么被折叠?



