這期內(nèi)容當中小編將會給大家?guī)碛嘘P(guān)MySQL中怎樣查看數(shù)據(jù)庫表容量大小,文章內(nèi)容豐富且以專業(yè)的角度為大家分析和敘述,閱讀完這篇文章希望大家可以有所收獲。
創(chuàng)新互聯(lián)建站堅持“要么做到,要么別承諾”的工作理念,服務(wù)領(lǐng)域包括:網(wǎng)站制作、網(wǎng)站設(shè)計、企業(yè)官網(wǎng)、英文網(wǎng)站、手機端網(wǎng)站、網(wǎng)站推廣等服務(wù),滿足客戶于互聯(lián)網(wǎng)時代的湟中網(wǎng)站設(shè)計、移動媒體設(shè)計的需求,幫助企業(yè)找到有效的互聯(lián)網(wǎng)解決方案。努力成為您成熟可靠的網(wǎng)絡(luò)建設(shè)合作伙伴!
information_schema簡介
在MySQL中,把 information_schema 看作是一個數(shù)據(jù)庫,確切說是信息數(shù)據(jù)庫。其中保存著關(guān)于MySQL服務(wù)器所維護的所有其他數(shù)據(jù)庫的信息。如數(shù)據(jù)庫名,數(shù)據(jù)庫的表,表欄的數(shù)據(jù)類型與訪問權(quán)限等。
SCHEMATA表:提供了當前mysql實例中所有數(shù)據(jù)庫的信息。
TABLES表:提供了關(guān)于數(shù)據(jù)庫中的表的信息(包括視圖)。詳細表述了某個表屬于哪個schema,表類型,表引擎,創(chuàng)建時間等信息。
COLUMNS表:提供了表中的列信息。詳細表述了某張表的所有列以及每個列的信息。
STATISTICS表:提供了關(guān)于表索引的信息。
下面是使用information_schema表查看數(shù)據(jù)庫信息的案例:
查看所有數(shù)據(jù)庫容量大小
select
table_schema as '數(shù)據(jù)庫',
sum(table_rows) as '記錄數(shù)',
sum(truncate(data_length/1024/1024, 2)) as '數(shù)據(jù)容量(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
查看所有數(shù)據(jù)庫各表容量大小
select
table_schema as '數(shù)據(jù)庫',
table_name as '表名',
table_rows as '記錄數(shù)',
truncate(data_length/1024/1024, 2) as '數(shù)據(jù)容量(MB)',
truncate(index_length/1024/1024, 2) as '索引容量(MB)'
from information_schema.tables
order by data_length desc, index_length desc
查看(指定庫)mysql庫容量大小
select
table_schema as '數(shù)據(jù)庫',
sum(table_rows) as '記錄數(shù)',
sum(truncate(data_length/1024/1024, 2)) as '數(shù)據(jù)容量(MB)',
sum(truncate(index_length/1024/1024, 2)) as '索引容量(MB)'
from information_schema.tables
where table_schema='mysql';
查看(指定庫)mysql庫各表容量大小
select
table_schema as '數(shù)據(jù)庫',
table_name as '表名',
table_rows as '記錄數(shù)',
truncate(data_length/1024/1024, 2) as '數(shù)據(jù)容量(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ù)據(jù)庫表容量大小了,如果剛好有類似的疑惑,不妨參照上述分析進行理解。如果想知道更多相關(guān)知識,歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道。
新聞名稱:MySQL中怎樣查看數(shù)據(jù)庫表容量大小
文章起源:http://jinyejixie.com/article26/gdjjjg.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站設(shè)計、標簽優(yōu)化、電子商務(wù)、微信小程序、靜態(tài)網(wǎng)站、域名注冊
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)