tags:

views:

51

answers:

2

I have noticed in phpMyAdmin you can click 'optimise' on tables, and it runs:

OPTIMIZE TABLE table_name

What does this actually do?

Should I have some cron job running daily that runs OPTIMIZE TABLE on my tables?

Thank you

+2  A: 

From InformIT

An optimized table structure is different than a well-designed table. Table structure optimization has to do with reclaiming unused space after deletions and basically cleaning up the table after structural modifications have been made. The OPTIMIZE SQL command takes care of this, using the following syntax:

OPTIMIZE TABLE table_name[,table_name]

Think of it like defragging your tables. A cron job might be a good idea, but do it during low/no load as it locks the tables.

Stefan Mai
Defragging tables! That makes it clear. I might do it monthly in a scheduled downtime.
alex
A: 

I'd start with the MySQL documentation about that command. After reading that, do you still have questions?

Rob Kennedy