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


/ Published in: MySQL
Save to your folder(s)

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


Copy this code and paste it in your HTML
  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;

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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.