Support » Plugins » [Plugin: WP-DB-Backup] Here’s how to OPTIMIZE tables during backup

  • While I do not wish to start a debate why one needs to OPTIMIZE one’s WordPress tables as often as one backs them up*, regular optimizing is crucial for tables with several variable-length rows that get many INSERTs and DELETEs, e.g., wp_comments and wp_posts.

    As it happens with the wp-db-backup plugin, this is easily done by adding only one line to the source code.

    $wpdb->get_results("OPTIMIZE TABLE ".implode(", ",$tables));

    The line should be added just before the foreach ($tables as $table) line in the db_backup function. It’s at line 897. Note that this affects only the scheduled backup process and not the one via the Admin screen — that would require another line. 🙂

    Happy Optimizing!

    *It’s debatable, but Yoast seems to agree with me (Tip #17/slide #37).

  • The topic ‘[Plugin: WP-DB-Backup] Here’s how to OPTIMIZE tables during backup’ is closed to new replies.