一、概述
最近上線了一個項目,運行了一個月。想知道mysql庫中,哪個表最大,有多少行數據。
由於庫里面有上百張表,一個個查看比較費勁。
二、查詢表大小
我需要查詢的庫名為:kite
因此sql語句為:
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='kite' order by table_rows desc, index_length desc;
結果如下:
本文參考鏈接:
https://www.cnblogs.com/--smile/p/11451238.html