找出mysql最佔硬盤的數據

查看每一個庫的使用狀況數據庫

selectide

table_schema as '數據庫',orm

sum(table_rows) as '記錄數',索引

sum(truncate(data_length/1024/1024, 2)) as '數據容量(MB)',it

sum(truncate(index_length/1024/1024, 2)) as '索引容量(MB)'io

from information_schema.tablestable

group by table_schemaform

order by sum(data_length) desc, sum(index_length) desc;class


查看每一個表的使用狀況select


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;

相關文章
相關標籤/搜索