• Resolved wwwoda

    (@wwwoda)


    Hi, we are trying to optimize a client’s website but ran into some problems when optimizing the wp_postmeta table. Interestingly it worked on the staging site which had a fairly recent sync with production.

    This the error. Hope you can give some insights how to fix this.

    WordPress database error Index for table 'wp_postmeta' is corrupt; try to repair it for query ALTER TABLE wp_postmeta ADD UNIQUE KEY meta_id (meta_id), DROP PRIMARY KEY, ADD PRIMARY KEY (post_id, meta_key, meta_id), DROP KEY meta_key, ADD KEY meta_key (meta_key, meta_value(32), post_id, meta_id), ADD KEY meta_value (meta_value(32), meta_id), DROP KEY post_id/**imfs-query-tag*935363677*/ made by include('phar:///usr/local/bin/wp/php/boot-phar.php'), include('phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/wp-cli.php'), WP_CLI\bootstrap, WP_CLI\Bootstrap\LaunchRunner->process, WP_CLI\Runner->start, WP_CLI\Runner->run_command_and_exit, WP_CLI\Runner->run_command, WP_CLI\Dispatcher\Subcommand->invoke, call_user_func, WP_CLI\Dispatcher\CommandFactory::WP_CLI\Dispatcher\{closure}, call_user_func, ImsfCli->enable, ImsfCli->doRekeying, ImfsDb->rekeyTables, ImfsDb->rekeyTable, ImfsDb->query
    PHP Fatal error: Uncaught ImfsException: [0]: Index for table 'wp_postmeta' is corrupt; try to repair it in ALTER TABLE wp_postmeta ADD UNIQUE KEY meta_id (meta_id), DROP PRIMARY KEY, ADD PRIMARY KEY (post_id, meta_key, meta_id), DROP KEY meta_key, ADD KEY meta_key (meta_key, meta_value(32), post_id, meta_id), ADD KEY meta_value (meta_value(32), meta_id), DROP KEY post_id/**imfs-query-tag*935363677*/

    thrown in /var/www/site/prod-v2/releases/12/web/app/plugins/index-wp-mysql-for-speed/code/imsfdb.php on line 477
    Fatal error: Uncaught ImfsException: [0]: Index for table 'wp_postmeta' is corrupt; try to repair it in ALTER TABLE wp_postmeta ADD UNIQUE KEY meta_id (meta_id), DROP PRIMARY KEY, ADD PRIMARY KEY (post_id, meta_key, meta_id), DROP KEY meta_key, ADD KEY meta_key (meta_key, meta_value(32), post_id, meta_id), ADD KEY meta_value (meta_value(32), meta_id), DROP KEY post_id/**imfs-query-tag*935363677*/

    thrown in /var/www/site/prod-v2/releases/12/web/app/plugins/index-wp-mysql-for-speed/code/imsfdb.php on line 477
Viewing 3 replies - 1 through 3 (of 3 total)
  • hungpham

    (@hungpham)

    It’s happening before the plugin tries to add new keys. You might want to repair the table first, for example, with phpMyAdmin

    Plugin Author OllieJones

    (@olliejones)

    Thanks for the question.

    Double check you have a backup. Then try this with wp-cli to repair the table.

    wp db query "REPAIR TABLE wp_postmeta;"

    Then try this:

    wp index-mysql status

    to see if it notices anything more amiss. Then …

    wp index-mysql enable wp_postmeta

    I’m not sure why table indexes sometimes turn up corrupt. Database server power failure in the past?

    Thread Starter wwwoda

    (@wwwoda)

    Thanks for the quick answers. We were able to quickly resolve the problem and everything works fine now!

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.