Posted By

zingo on 03/04/09


Tagged

mysql sql info stats


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

jamesming
virendrakryadav


MySQL table size, number of rows, and size of indexes


 / Published in: MySQL
 

URL: http://axonflux.com/useful-query-mysql-table-index

Show table size, number of rows, and size of indexes in MySQL.

  1. SELECT CONCAT(table_schema,'.',table_name),
  2. CONCAT(ROUND(table_rows/1000000,2),'M') rows,
  3. CONCAT(ROUND(data_length/(1024*1024*1024),2),'G') DATA,
  4. CONCAT(ROUND(index_length/(1024*1024*1024),2),'G') idx,
  5. CONCAT(ROUND((data_length+index_length)/(1024*1024*1024),2),'G') total_size,
  6. ROUND(index_length/data_length,2) idxfrac
  7. FROM information_schema.TABLES
  8. ORDER BY data_length+index_length DESC LIMIT 20;

Report this snippet  

You need to login to post a comment.