Showing posts with label table size. Show all posts
Showing posts with label table size. Show all posts

Thursday, May 24, 2012

Largest tables on MySQL Server

Query below to find out table size. Here is original article by Peter Zaitsev Click Here

SELECT
  CONCAT(table_schema, '.', table_name),
  CONCAT(ROUND(table_rows / 1000000, 2), 'M')  AS rows,      
  CONCAT(ROUND(data_length / ( 1024 * 1024 * 1024 ), 2), 'G') AS data,          
CONCAT(ROUND(index_length / ( 1024 * 1024 * 1024 ), 2), 'G') AS idx,
 CONCAT(ROUND(( data_length + index_length ) / ( 1024 * 1024 * 1024 ), 2), 'G') AS total_size,         ROUND(index_length / data_length, 2)  AS idxfrac
FROM  
information_schema.TABLES ORDER  BY data_length + index_length DESC LIMIT  10;