MySQL查看數(shù)據(jù)庫(kù)表容量大小的方法示例
本文介紹MySQL查看數(shù)據(jù)庫(kù)表容量大小的命令語(yǔ)句,提供完整查詢語(yǔ)句及實(shí)例,方便大家學(xué)習(xí)使用。
1.查看所有數(shù)據(jù)庫(kù)容量大小
select table_schema as '數(shù)據(jù)庫(kù)', 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;
2.查看所有數(shù)據(jù)庫(kù)各表容量大小
select table_schema as '數(shù)據(jù)庫(kù)', 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;
3.查看指定數(shù)據(jù)庫(kù)容量大小
例:查看mysql庫(kù)容量大小
select table_schema as '數(shù)據(jù)庫(kù)', 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';
4.查看指定數(shù)據(jù)庫(kù)各表容量大小
例:查看mysql庫(kù)各表容量大小
select table_schema as '數(shù)據(jù)庫(kù)', 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;

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
- Mysql如何刪除數(shù)據(jù)庫(kù)表中的某一列
- MySQL數(shù)據(jù)庫(kù)表約束講解
- 為什么Mysql?數(shù)據(jù)庫(kù)表中有索引還是查詢慢
- MySQL數(shù)據(jù)庫(kù)表被鎖、解鎖以及刪除事務(wù)詳解
- Mysql數(shù)據(jù)庫(kù)表中為什么有索引卻沒(méi)有提高查詢速度
- MySQL學(xué)習(xí)之?dāng)?shù)據(jù)庫(kù)表五大約束詳解小白篇
- MYSQL數(shù)據(jù)庫(kù)表結(jié)構(gòu)優(yōu)化方法詳解
- MySQL數(shù)據(jù)庫(kù)表的合并與分區(qū)實(shí)現(xiàn)介紹
相關(guān)文章
讓MySQL中某個(gè)表的操作不生成binlog日志的問(wèn)題解決
文章介紹了四種方法讓MySQL中某個(gè)表的操作不生成binlog日志:會(huì)話級(jí)臨時(shí)關(guān)閉binlog、通過(guò)復(fù)制過(guò)濾規(guī)則、調(diào)整binlog格式和全局禁用binlog,每種方法都有其適用場(chǎng)景和局限性,建議優(yōu)先使用會(huì)話級(jí)臨時(shí)關(guān)閉方法,并根據(jù)具體需求選擇合適的方案,感興趣的朋友跟隨小編一起看看吧2025-03-03
ubuntu linux下使用Qt連接MySQL數(shù)據(jù)庫(kù)的方法
Linux下完整的MySQL開(kāi)發(fā)需要安裝服務(wù)器端,如果安裝客戶端也沒(méi)什么不好。直接在軟件中心搜mysql,把client和server選上。2011-08-08
MYSQL 數(shù)據(jù)庫(kù)命名與設(shè)計(jì)規(guī)范
對(duì)于MYSQL 數(shù)據(jù)庫(kù)的命名與設(shè)計(jì),需要一定的規(guī)范,所以我們要了解和快速的掌握mysql有很多的幫助。2008-12-12
MySQL數(shù)據(jù)庫(kù)運(yùn)維之?dāng)?shù)據(jù)恢復(fù)的方法
本篇文章主要介紹了MySQL數(shù)據(jù)庫(kù)運(yùn)維之?dāng)?shù)據(jù)恢復(fù)的方法,此處總結(jié)一下恢復(fù)方案,并結(jié)合數(shù)據(jù)庫(kù)的二進(jìn)制日志做下數(shù)據(jù)恢復(fù)的示范。小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2018-06-06

