欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Mysql查询数据库表大小

程序员文章站 2024-03-21 14:36:46
...

 

查询数据库及索引大小

select concat(round(sum(DATA_LENGTH/1024/1024),3),"MB") as data_size, concat(round(sum(MAX_DATA_LENGTH/1024/1024),3),"MB") as max_data_size,concat(round(sum(INDEX_LENGTH/1024/1024),3),"MB") as index_size,concat(round(sum(DATA_FREE/1024/1024),3),"MB") as data_free from tables where table_schema="yxq";

Mysql查询数据库表大小

 

查询指定数据库各表所占内存

SELECT TABLE_NAME,DATA_LENGTH+INDEX_LENGTH,TABLE_ROWS,concat(round((DATA_LENGTH+INDEX_LENGTH)/1024/1024,2), 'MB') as data

FROM information_schema.tables WHERE TABLE_SCHEMA='yxq' ORDER BY DATA_LENGTH+INDEX_LENGTH desc;

Mysql查询数据库表大小

相关标签: MySQL