SELECT concat(round(table_rows/1000000,2),'M',' rows') as table_rows,concat(round(data_length/(1024*1024*1024),2),'G',' DATA') as data_size,concat(round(index_length/(1024*1024*1024),2),'G',' idx') as index_size,concat(round((data_length+index_length)/(1024*1024*1024),2),'G',' total_size') as total_size,concat(round(index_length/data_length,2),' idxratio') as index_ratio,concat(table_schema,'.',table_name) as table_name FROM information_schema.TABLES ORDER BY data_length+index_length DESC LIMIT 10\G;
本文提供了一个SQL查询示例,用于获取数据库中各表的基本信息,包括表名、表行数及数据、索引的大小等,并按总大小降序排列,便于数据库管理员快速了解表的占用情况。
822

被折叠的 条评论
为什么被折叠?



