Skip to content

Instantly share code, notes, and snippets.

@jwilkins
Created February 4, 2013 05:19
Show Gist options
  • Save jwilkins/4705147 to your computer and use it in GitHub Desktop.
Save jwilkins/4705147 to your computer and use it in GitHub Desktop.
Faster mysql dump import (innodb) & database size checks
(echo "SET autocommit=0; SET unique_checks=0; SET foreign_key_checks=0;"; cat database_name.sql ; echo "COMMIT;" ) | mysql database_name
# in /etc/my.cnf set:
# innodb_flush_log_at_trx_commit = 2
# innodb_file_per_table
# check size of databases:
#SELECT table_schema AS "Data Base Name",
#ROUND(SUM( data_length + index_length ) / 1024 / 1024, 2) AS "Data Base Size in MB"
#FROM information_schema.TABLES GROUP BY table_schema ;
# check table 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 = "database_name";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment