共計(jì) 1283 個(gè)字符,預(yù)計(jì)需要花費(fèi) 4 分鐘才能閱讀完成。
自動(dòng)寫代碼機(jī)器人,免費(fèi)開(kāi)通
MySQL 中怎么查看數(shù)據(jù)庫(kù)表容量大小,很多新手對(duì)此不是很清楚,為了幫助大家解決這個(gè)難題,下面丸趣 TV 小編將為大家詳細(xì)講解,有這方面需求的人可以來(lái)學(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ù)容量大小
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ù)各表容量大小
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;
看完上述內(nèi)容是否對(duì)您有幫助呢?如果還想對(duì)相關(guān)知識(shí)有進(jìn)一步的了解或閱讀更多相關(guān)文章,請(qǐng)關(guān)注丸趣 TV 行業(yè)資訊頻道,感謝您對(duì)丸趣 TV 的支持。
向 AI 問(wèn)一下細(xì)節(jié)正文完
發(fā)表至: 數(shù)據(jù)庫(kù)
2023-12-04