菜鸟国际电子游戏首页 > 文章中心 > 正文

查询mysql数据库或表占磁盘空间大小-电子游戏app下载


查看全库大小::
select table_schema as '数据库',
sum(table_rows) as '记录数',
sum(truncate(data_length / 1024 / 1024, 2)) as '数据容量(mb)',
sum(truncate(index_length / 1024 / 1024, 2)) as '索引容量(mb)'
from information_schema.tables
group by table_schema
order by sum(data_length) desc, sum(index_length) desc;


查看全库表大小::
select table_schema as '数据库',
table_name as '表名',
table_rows as '记录数',
truncate(data_length / 1024 / 1024, 2) as '数据容量(mb)',
truncate(index_length / 1024 / 1024, 2) as '索引容量(mb)'
from information_schema.tables
order by data_length desc, index_length desc;


查看指定数据库大小::
select table_schema as '数据库',
sum(table_rows) as '记录数',
sum(truncate(data_length / 1024 / 1024, 2)) as '数据容量(mb)',
sum(truncate(index_length / 1024 / 1024, 2)) as '索引容量(mb)'
from information_schema.tables
where table_schema = '库名';


查看指定库中各表大小::
select table_schema as '数据库',
table_name as '表名',
table_rows as '记录数',
truncate(data_length / 1024 / 1024, 2) as '数据容量(mb)',
truncate(index_length / 1024 / 1024, 2) as '索引容量(mb)'
from information_schema.tables
where table_schema = '库名'
order by data_length desc, index_length desc;





转载请注明出处:

0

相关文章