mysql 查看表数据大小条数

mysql的information_schema库重

tables存储了数据表的元数据信息,下面是其中几个字段的含义:

table_schema: 记录数据库名;
table_name: 记录数据表名;
table_rows: 关于表的粗略行估计;
data_length : 记录表的大小(单位字节);
index_length : 记录表的索引的大小;
要查看表的大小,条数,可以查data_length,table_rows

select TABLE_NAME, concat(truncate(data_length/1024/1024,2),' MB') as data_size,table_rows
from information_schema.tables where TABLE_SCHEMA = 'dbName'
and TABLE_NAME in ("tableName1","tableName2")

 

阅读剩余
THE END