How can you determine how much disk space a particular MySQL table is taking up?

前端 未结 8 521
死守一世寂寞
死守一世寂寞 2020-11-30 16:20

Is there a quick way to determine how much disk space a particular MySQL table is taking up? The table may be MyISAM or Innodb.

8条回答
  •  抹茶落季
    2020-11-30 17:02

    Quick bit of SQL to get the top 20 biggest tables in MB.

    SELECT table_schema, table_name,
      ROUND((data_length+index_length)/POWER(1024,2),2) AS tablesize_mb
    FROM information_schema.tables
    ORDER BY tablesize_mb DESC LIMIT 20;
    

    Hope that's useful to somebody!

提交回复
热议问题