03/31/2010 - 14:17
Repair or optimize MySQL database on a shell
To fight fragmented databases, it is always a good idea to re-optimize your MySQL database especially if you have a lot of varying characters (VARCHAR).
The basic way is via a SQL query.
bash> mysql
mysql> OPTIMIZE TABLE foo;
mysqlcheck -op database_name
mysqlcheck -op -u user_name database_name
mysqlcheck -op -u user_name –all-databases
Query: SELECT min(dob) FROM $tableName
The hardest query performs a scan of all million rows.
InnoDB is better than MyISAM by ~30% with 4-16 threads, but MyISAM scales a bit better in this case.
InnoDB is better than Falcon by 2-3 times. - Login to post comments