查看mysql数据表的表空间大小

select concat(round(sum(DATA_LENGTH/1024/1024),2),'MB') as data from information_schema.TABLES where table_schema='数据库名字' and table_name='表名字';

下面是按G单位查看,举一反三吧

SELECT concat(round((sum(DATA_LENGTH)+sum(INDEX_LENGTH))/1024/1024/1024,2),'G') 
as total_size FROM information_schema.TABLES where table_schema='数据库名' and 
 table_name='表名';

或者再MySQL的数据目录下通过shell命令直接查看ibd文件的大小
du -sh xx.ibd

猜你喜欢

转载自blog.csdn.net/m0_37827567/article/details/82980131
今日推荐