您好,欢迎访问一九零五行业门户网

统计MySQL数据表大小

欢迎进入linux社区论坛,与200万技术人员互动交流 >>进入 有时候需要查询mysql数据库中各个表大小,该如何操作呢? mysql中有一个名为 information_schema 的数据库,在该库中有一个 tables 表,这个表主要字段分别是: table_schema : 数据库名 table_name:
欢迎进入linux社区论坛,与200万技术人员互动交流 >>进入
有时候需要查询mysql数据库中各个表大小,该如何操作呢?
mysql中有一个名为 information_schema 的数据库,在该库中有一个 tables 表,这个表主要字段分别是:
table_schema : 数据库名
table_name:表名
engine:所使用的存储引擎
tables_rows:记录数
data_length:数据大小
index_length:索引大小
其他字段请参考mysql的手册。
use information_schema;
select
table_name,
(data_length/1024/1024) as datam ,
(index_length/1024/1024) as indexm,
((data_length+index_length)/1024/1024) as allm,
table_rows
from
tables
where
table_schema = 'db_ip';
其它类似信息

推荐信息