SQL命令为:
SELECT TABLE_NAME,DATA_LENGTH+INDEX_LENGTH,TABLE_ROWS,concat(round((DATA_LENGTH+INDEX_LENGTH)/1024/1024,2), ‘MB‘) as data FROM TABLES WHERE TABLE_SCHEMA=‘dbmysql‘;
或
select TABLE_NAME, concat(truncate(data_length/1024/1024,2),‘ MB‘) as data_size,concat(truncate(index_length/1024/1024,2),‘ MB‘) as index_size from information_schema.tables where TABLE_SCHEMA = ‘dbmysql‘ group by TABLE_NAME order by data_length desc;
说明:
TABLE_SCHEMA : 数据库名
TABLE_NAME:表名
ENGINE:所使用的存储引擎
DATA_LENGTH:数据大小
INDEX_LENGTH:索引大小
TABLES_ROWS:记录数
时间: 2024-11-09 03:49:22