mysql怎么查看数据库中表的大小

mysql怎么查看数据库中表的大小,第1张

1、查询整个mysql数据库,整个库的大小;单位转换为MB。

select concat(round(sum(DATA_LENGTH/1024/1024),2),'MB') as data  from information_schema.TABLES

2、查询mysql数据库,某个库的大小;

select concat(round(sum(DATA_LENGTH/1024/1024),2),'MB') as data

from information_schema.TABLES

where table_schema = 'testdb'

3、查看库中某个表的大小;

select concat(round(sum(DATA_LENGTH/1024/1024),2),'MB') as data

from information_schema.TABLES

where table_schema = 'testdb'

 and table_name = 'test_a'

4、查看mysql库中,test开头的表,所有存储大小;

select concat(round(sum(DATA_LENGTH/1024/1024),2),'MB') as data

from information_schema.TABLES

where table_schema = 'testdb'

 and table_name like 'test%'

数据库。对于数据库的大小,需要注意的问题是数据库的大小不能以表空间的分配大小而论,数据库是32767个数据库,最小为1MB,最大为1TB,表是每个数据库最多有20亿个表,数据库大小没有限制,比表更大,表大小上限为32TB。


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/sjk/9919881.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-05-03
下一篇2023-05-03

发表评论

登录后才能评论

评论列表(0条)

    保存