mysql数据库各表、数据库数据容量查询
生活随笔
收集整理的這篇文章主要介紹了
mysql数据库各表、数据库数据容量查询
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
1、查詢數(shù)據(jù)庫各表記錄數(shù)、數(shù)據(jù)容量(MB)、索引容量(MB)
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='database_name' order by data_length desc, index_length desc;2、查詢各數(shù)據(jù)庫的記錄數(shù)、數(shù)據(jù)容量(MB)、索引容量(MB)
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;?
總結(jié)
以上是生活随笔為你收集整理的mysql数据库各表、数据库数据容量查询的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: laravel修改storage目录和b
- 下一篇: 贪心算法区间调度问题思路代码证明