色综合图-色综合图片-色综合图片二区150p-色综合图区-玖玖国产精品视频-玖玖香蕉视频

您的位置:首頁技術(shù)文章
文章詳情頁

Mysql 查詢數(shù)據(jù)庫容量大小的方法步驟

瀏覽:103日期:2023-10-14 15:26:56

查詢所有數(shù)據(jù)庫的總大小

方法如下:

mysql> use information_schema;mysql> select concat(round(sum(DATA_LENGTH/1024/1024),2),’MB’) as data from TABLES;+-----------+| data |+-----------+| 3052.76MB |+-----------+1 row in set (0.02 sec)

統(tǒng)計(jì)一下所有庫數(shù)據(jù)量

每張表數(shù)據(jù)量=AVG_ROW_LENGTH*TABLE_ROWS+INDEX_LENGTH

SELECTSUM(AVG_ROW_LENGTH*TABLE_ROWS+INDEX_LENGTH)/1024/1024 AS total_mbFROM information_schema.TABLES

統(tǒng)計(jì)每個(gè)庫大小:

SELECTtable_schema,SUM(AVG_ROW_LENGTH*TABLE_ROWS+INDEX_LENGTH)/1024/1024 AS total_mbFROM information_schema.TABLES group by table_schema;

第二種情況:查看指定數(shù)據(jù)庫的大小,比如說:數(shù)據(jù)庫test,方法如下:

mysql> use information_schema;mysql> select concat(round(sum(DATA_LENGTH/1024/1024),2),’MB’) as data from TABLES where table_schema=’test’;+----------+| data |+----------+| 142.84MB |+----------+1 row in set (0.00 sec)

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

selecttable_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.tablesgroup by table_schemaorder by sum(data_length) desc, sum(index_length) desc;

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

selecttable_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.tablesorder by data_length desc, index_length desc;

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

例:查看mysql庫容量大小selecttable_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.tableswhere table_schema=’mysql’; 

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

例:查看mysql庫各表容量大小selecttable_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.tableswhere table_schema=’mysql’order by data_length desc, index_length desc;

題外方法

直接用shell命令統(tǒng)計(jì)mysql data目錄中的大小(注意只有庫,不包含數(shù)據(jù)庫日志大小)

備注 :

data_length :存儲(chǔ)數(shù)據(jù)大小

data_length/1024/1024:將字節(jié)轉(zhuǎn)換為MB

round(sum(data_length/1024/1024),2):取兩位小數(shù)

concat(round(sum(data_length/1024/1024),2),’MB’) :給計(jì)算結(jié)果追加單位 “MB”

到此這篇關(guān)于Mysql 查詢數(shù)據(jù)庫容量大小的方法步驟的文章就介紹到這了,更多相關(guān)Mysql 查詢數(shù)據(jù)庫容量大小內(nèi)容請(qǐng)搜索好吧啦網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持好吧啦網(wǎng)!

標(biāo)簽: MySQL 數(shù)據(jù)庫
相關(guān)文章:
主站蜘蛛池模板: 久草视频大全 | 免费一区二区三区视频狠狠 | 国产日韩高清一区二区三区 | 一本色综合 | 精品国产午夜肉伦伦影院 | 日本三级一区 | 姐姐真漂亮在线视频中文版 | 久久久久久久久久久久久久久久久 | 九九九九九九精品免费 | 在线观看精品国内福利视频 | 一区二区三区伦理 | 亚洲第一se情网站 | 国产亚洲精品自在久久77 | 18在线观看国内精品视频 | 国产91精品高清一区二区三区 | 欧美午夜a级精美理论片 | 欧美成人艳星在线播放 | 精品成人免费一区二区在线播放 | 一级特黄aa大片欧美网站 | 日韩视频在线观看一区 | 国产一区亚洲二区三区 | 日本黄色大片在线播放视频免费观看 | 老色99久久九九精品尤物 | 久久久久久久久久久视频国内精品视频 | 国产l精品国产亚洲区久久 国产tv在线 | 国内精品伊人久久久久妇 | 国产一二区 | 成人免费在线视频 | 欧美成人免费在线观看 | 精品国产欧美一区二区五十路 | 日本在线免费播放 | 国产99精品免费视频看6 | 亚洲天堂区 | 99精品在线观看视频 | 欧美国产伦久久久久 | 成人影院午夜久久影院 | 大片毛片女女女女女女女 | 久久性精品| 成人免费一级在线播放 | 一区二区三区在线看 | 美女视频网站免费播放视 |