mysql 表空間及索引大小的檢視

2021-06-07 06:31:39 字數 536 閱讀 5050

table_schema 是資料庫名

mysql> select concat(table_schema,'.',table_name) as 'table name',

-> concat(round(table_rows/1000000,2),'m') as 'number of rows',

-> concat(round(data_length/(1024*1024*1024),2),'g') as 'data size',

-> concat(round(index_length/(1024*1024*1024),2),'g') as 'index size' ,

-> concat(round((data_length+index_length)/(1024*1024*1024),2),'g') as'total'

-> from information_schema.tables where table_schema like 'eco'

-> order by total desc;

mysql表空間及索引大小的檢視

如果想知道mysql資料庫中每個表占用的空間 表記錄的行數的話,可以開啟mysql的 information schema 資料庫。在該庫中有乙個 tables 表,這個表主要字段分別是 table schema 資料庫名 table name 表名 engine 所使用的儲存引擎 tables r...

mysql 表空間及索引的檢視方法

1.檢視索引 1 單位是gb select concat round sum index length 1024 1024 1024 2 gb as total index size from information schema.tables where table schema like dat...

查詢臨時表空間大小及壓縮空間大小

查詢臨時表空間 select f.tablespace name,d.file name tempfile name round f.bytes free f.bytes used 1024 1024,2 total mb round f.bytes free f.bytes used nvl p....