James Jefferies and ShedCode Ltd

The world of James and ShedCode

How Big Are My MySQL Tables?

| Comments

You may ask yourself this question - here is a little query from MySQL performance blog which may well help:

1
2
3
4
5
6
7
8
9
10
SELECT count(*) TABLES,
TABLE_NAME,
concat(round(sum(table_rows)/1000000,2),'M') rows,
concat(round(sum(data_length)/(1024*1024*1024),2),'G') DATA,
concat(round(sum(index_length)/(1024*1024*1024),2),'G') idx,
concat(round(sum(data_length+index_length)/(1024*1024*1024),2),'G') total_size,
round(sum(index_length)/sum(data_length),2) idxfrac
FROM information_schema.TABLES
group by TABLE_NAME
order by total_size desc;

Comments