# My InnoDB Table is corrupted from optimize table.

**URL:** <https://forums.percona.com/t/my-innodb-table-is-corrupted-from-optimize-table/1792>\
**Category:** Other MySQL® Questions\
**Created:** [April 6, 2012, 3:13am UTC](https://forums.percona.com/t/my-innodb-table-is-corrupted-from-optimize-table/1792 "2012-04-06T03:13:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![heha](https://avatars.discourse-cdn.com/v4/letter/h/b5a626/32.png) [@heha](https://forums.percona.com/u/heha)\
**Post date:** [April 6, 2012, 3:13am UTC](https://forums.percona.com/t/my-innodb-table-is-corrupted-from-optimize-table/1792/1 "2012-04-06T03:13:43Z")

</div>

My server autorun optimize table everyday and today, it run and failed for 6 hours until I found out. Percona Server become cannot start. It keep saying page is corrupt so, I set innodb\_force\_recovery=1 and it can run again. I do recover by using below method

[http://www.mysqlperformanceblog.com/2008/07/04/recovering-in](http://www.mysqlperformanceblog.com/2008/07/04/recovering-in) nodb-table-corruption/

It helped me recover some of database out but 20% is unrecoverable and it’s table user which is the most important.

My question is “Did optimize table should not be run everyday to make the database run faster?” and “Do optimize table can make the database corrupt?” My server is Joyentcloud which is run on OpenSolaris with Percona Server 5.5. I suspect if it’s hardware problem from hosting itself or it’s some mysql bug. Do you have any suggestion?

---

<div class="post-metadata">

**Author:** ![xaprb](https://avatars.discourse-cdn.com/v4/letter/x/49beb7/32.png) [@xaprb](https://forums.percona.com/u/xaprb)\
**Post date:** [April 6, 2012, 7:45am UTC](https://forums.percona.com/t/my-innodb-table-is-corrupted-from-optimize-table/1792/2 "2012-04-06T07:45:35Z")

</div>

If it’s getting corrupted, there is probably a problem with the storage system. It is very unlikely that it’s a MySQL bug.

You are not supposed to be able to corrupt your database! You are not doing anything wrong.

I would not optimize the table every day unless you can measure that it improves performance. See [http://www.xaprb.com/blog/2010/02/07/how-often-should-you-us](http://www.xaprb.com/blog/2010/02/07/how-often-should-you-us) e-optimize-table/

---

<div class="post-metadata">

**Author:** ![heha](https://avatars.discourse-cdn.com/v4/letter/h/b5a626/32.png) [@heha](https://forums.percona.com/u/heha)\
**Post date:** [April 6, 2012, 8:13am UTC](https://forums.percona.com/t/my-innodb-table-is-corrupted-from-optimize-table/1792/3 "2012-04-06T08:13:40Z")

</div>

Do it possible that cronjob accidentally run optimize twice while the first one still running and end up corrupt table?
