您好,登錄后才能下訂單哦!
本篇內容介紹了“mysql如何查詢數據庫容量”的有關知識,在實際案例的操作過程中,不少人都會遇到這樣的困境,接下來就讓小編帶領大家學習一下如何處理這些情況吧!希望大家仔細閱讀,能夠學有所成!
mysql查詢數據庫容量的方法:1、打開DOS窗口,然后進入mysql的bin目錄下;2、執行“SELECT table_schema AS 'shujuku',table_name AS 'biaoming',table_rows AS 'jilushu',TRUNCATE (data_length / 1024 / 1024, 2) ...”語句即可查看所有數據庫各表容量。
MySql查看數據庫及表容量并排序查看所有數據庫容量
SELECT
table_schema AS '數據庫',
sum(table_rows) AS '記錄數',
sum(
TRUNCATE (data_length / 1024 / 1024, 2)
) AS '數據容量(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;
查看所有數據庫各表容量
SELECT
table_schema AS '數據庫',
table_name AS '表名',
table_rows AS '記錄數',
TRUNCATE (data_length / 1024 / 1024, 2) AS '數據容量(MB)',
TRUNCATE (index_length / 1024 / 1024, 2) AS '索引容量(MB)'
FROM
information_schema. TABLES
ORDER BY
data_length DESC,
index_length DESC;
查看指定數據庫容量
SELECT
table_schema AS '數據庫',
sum(table_rows) AS '記錄數',
sum(
TRUNCATE (data_length / 1024 / 1024, 2)
) AS '數據容量(MB)',
sum(
TRUNCATE (index_length / 1024 / 1024, 2)
) AS '索引容量(MB)'
FROM
information_schema.tables where table_schema = 'your_table_name';
查看指定數據庫各表容量
SELECT
table_schema AS '數據庫',
table_name AS '表名',
table_rows AS '記錄數',
TRUNCATE ( data_length / 1024 / 1024, 2 ) AS '數據容量(MB)',
TRUNCATE ( index_length / 1024 / 1024, 2 ) AS '索引容量(MB)'
FROM
information_schema.TABLES
WHERE
table_schema = '指定的庫名'
ORDER BY
data_length DESC,
index_length DESC;
“mysql如何查詢數據庫容量”的內容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業相關的知識可以關注億速云網站,小編將為大家輸出更多高質量的實用文章!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。