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")

 

版权声明:
作者:youlijiang
链接:https://www.cnesa.cn/1146.html
来源:正群欣世
文章版权归作者所有,未经允许请勿转载。

THE END
分享
二维码
< <上一篇
下一篇>>