MySQL database size script

Useful scripts that count MySQL database size or individual tables sizes (taken from: http://www.mkyong.com/mysql/how-to-calculate-the-mysql-database-size/): 

Database size:
SELECT table_schema "Data Base Name", SUM( data_length + index_length) / 1024 / 1024 "Data Base Size in MB" FROM information_schema.TABLES GROUP BY table_schema;

Individual tables sizes:
SELECT TABLE_NAME, table_rows, data_length, index_length, round(((data_length + index_length) / 1024 / 1024),2) "Size in MB" FROM information_schema.TABLES WHERE table_schema = "schema_name";

Comments

Popular posts from this blog

Hibernate delete and update queries with joins

Access application Google Drive account from javascript without client side authorization dialog

How to set width of a table within Twitter Bootstrap