MySQL - How to Show Data and Index Size in your Tables
July 1, 2025
note-to-self
How to show data and index size in your mysql tables.
select table_schema, TABLE_NAME, dat, idx from
(SELECT table_schema, TABLE_NAME,
( data_length ) / 1024 / 1024 as dat,
( index_length ) / 1024 / 1024 as idx
FROM information_schema.TABLES
order by 3 desc ) a
order by 3 desc
limit 10;
Most posts are for my own reference and reflection, and shouldn’t be taken as fully accurate or instructional.