如何查看MySQL數(shù)據庫表容量大小

如何查看MySQL數(shù)據庫表容量大小?很多新手對此不是很清楚,為了幫助大家解決這個難題,下面小編將為大家詳細講解,有這方面需求的人可以來學習下,希望你能有所收獲。

創(chuàng)新互聯(lián)-專業(yè)網站定制、快速模板網站建設、高性價比鄢陵網站開發(fā)、企業(yè)建站全套包干低至880元,成熟完善的模板庫,直接使用。一站式鄢陵網站制作公司更省心,省錢,快速模板網站建設找我們,業(yè)務覆蓋鄢陵地區(qū)。費用合理售后完善,十余年實體公司更值得信賴。

1.查看所有數(shù)據庫容量大小

select 
table_schema as '數(shù)據庫',
sum(table_rows) as '記錄數(shù)',
sum(truncate(data_length/1024/1024, 2)) as '數(shù)據容量(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;

2.查看所有數(shù)據庫各表容量大小

select 
table_schema as '數(shù)據庫',
table_name as '表名',
table_rows as '記錄數(shù)',
truncate(data_length/1024/1024, 2) as '數(shù)據容量(MB)',
truncate(index_length/1024/1024, 2) as '索引容量(MB)'
from information_schema.tables
order by data_length desc, index_length desc;

3.查看指定數(shù)據庫容量大小

例:查看mysql庫容量大小

select 
table_schema as '數(shù)據庫',
sum(table_rows) as '記錄數(shù)',
sum(truncate(data_length/1024/1024, 2)) as '數(shù)據容量(MB)',
sum(truncate(index_length/1024/1024, 2)) as '索引容量(MB)'
from information_schema.tables
where table_schema='mysql';

如何查看MySQL數(shù)據庫表容量大小 

4.查看指定數(shù)據庫各表容量大小

例:查看mysql庫各表容量大小

select 
table_schema as '數(shù)據庫',
table_name as '表名',
table_rows as '記錄數(shù)',
truncate(data_length/1024/1024, 2) as '數(shù)據容量(MB)',
truncate(index_length/1024/1024, 2) as '索引容量(MB)'
from information_schema.tables
where table_schema='mysql'
order by data_length desc, index_length desc;

如何查看MySQL數(shù)據庫表容量大小

看完上述內容是否對您有幫助呢?如果還想對相關知識有進一步的了解或閱讀更多相關文章,請關注創(chuàng)新互聯(lián)行業(yè)資訊頻道,感謝您對創(chuàng)新互聯(lián)的支持。

分享題目:如何查看MySQL數(shù)據庫表容量大小
網址分享:http://muchs.cn/article38/ipijpp.html

成都網站建設公司_創(chuàng)新互聯(lián),為您提供網站設計公司、網站建設、品牌網站設計、品牌網站建設響應式網站、網站排名

廣告

聲明:本網站發(fā)布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創(chuàng)新互聯(lián)

搜索引擎優(yōu)化