MYSQL查看錶與庫的容量大小


查看錶的容量大小
mysql> use information_schema;
select data_length,index_length
from tables where
table_schema='test'
 and table_name = 'test_table';

#字節轉MB
select concat(round(sum(data_length/1024/1024),2),'MB') as data_size_mb,
concat(round(sum(index_length/1024/1024),2),'MB') as  index_size_mb
from tables where
table_schema='test'
and table_name = 'test_table';


查看庫的容量大小
select TABLE_SCHEMA, concat(truncate(sum(data_length)/1024/1024,2),' MB') as data_size,
concat(truncate(sum(index_length)/1024/1024,2),'MB') as index_size
from information_schema.tables
group by TABLE_SCHEMA
order by data_length desc;


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章