本文介紹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.tablesgroup by table_schemaorder 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.tablesorder by data_length desc, index_length desc;
例:查看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.tableswhere table_schema='mysql';
範例:查看mysql庫各表容量大小
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.tableswhere table_schema='mysql'order by data_length desc, index_length desc;
本文說明如何透過MySQL查看資料庫表格容量大小,更多相關內容請關注php中文網。
相關推薦:
關於php str_getcsv把字串解析為陣列的使用方法的講解
以上是如何透過MySQL查看資料庫表容量大小的詳細內容。更多資訊請關注PHP中文網其他相關文章!