# Does MYSQL do "OPTIMAZE TABLE" online ???

**URL:** <https://forums.percona.com/t/does-mysql-do-optimaze-table-online/786>\
**Category:** Other MySQL® Questions\
**Created:** [June 3, 2008, 8:40am UTC](https://forums.percona.com/t/does-mysql-do-optimaze-table-online/786 "2008-06-03T08:40:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![vpestovnikov](https://avatars.discourse-cdn.com/v4/letter/v/a6a055/32.png) [@vpestovnikov](https://forums.percona.com/u/vpestovnikov)\
**Post date:** [June 3, 2008, 8:40am UTC](https://forums.percona.com/t/does-mysql-do-optimaze-table-online/786/1 "2008-06-03T08:40:04Z")

</div>

Hi all,  
Probably it is dump question, but I couldn’t find it in the documentation and this forum.

Q1: When I do “OPTIMIZE TABLE” (table has MyISAM type), does MySQL lock this table?

Q2: Is this operation online?

Q3: Is that right that, in during the “OPTIMIZE TABLE” process, MySQL is copying everything into a temp table and then copies it back when this operation will be finished. Am I right?

What I need to do is to create a trigger to purge a data older then 6 month from an original table to archive table and then optimize them both.

Q4: Are there any better methods to purge the old data to the different tables?

Thanks in advance. Any answers are appreciated.
