#!/bin/sh set -e set -u # I'm just getting acquainted with mysql so cut me some slack ;) # check if tables are myisam or innodb (all the ones I inherited seem to be myisam, drat) SHOW TABLE STATUS FROM `database`; ## optimize tables # source: http://stackoverflow.com/questions/5474662/mysql-optimize-all-tables # source2: http://www.xaprb.com/blog/2010/02/07/how-often-should-you-use-optimize-table/ mysqlcheck -o # -or- (for all databases mysqlcheck -o --all-databases mysqlcheck -o -u -p ## dump data and import again # sourcE: http://stackoverflow.com/questions/5475200/mysql-restoring-a-database-via-mysqldump-does-it-overwrite-the-different-desti?rq=1 # handy options: add-drop-table and add-drop-database # export mysqldump -uuser -ppassword SourceDatabase > file.sql # import mysql -u USER -p DATABASE < FILE.SQL ## mysql big deletes # source: http://mysql.rjweb.org/doc.php/deletebig # use paritions or delete in chunks... # testing the sublime plugin