☑ Optimize a MySQL database

☑ Optimize a MySQL database

If you have deleted a large part of your table or updated many variable length rows, you should consider running the optimize command.

If you want to quickly generate the optimize commands for every table in you database, executing the following MySQL statement:

select concat("optimize table " , TABLE_NAME , ';')

   from INFORMATION_SCHEMA.TABLES

where TABLE_SCHEMA <> 'information_schema' order by 1;
whoami
Stefan Pejcic
Join the discussion

I enjoy constructive responses and professional comments to my posts, and invite anyone to comment or link to my site.