60Web60

How to Optimize WordPress Database

WordPress Help4 min read·

This article explains how to optimize your WordPress database to improve your website's speed and performance.

What is Database Optimization?

Your WordPress database stores all your website content, including posts, pages, comments, and settings. Over time, it collects unnecessary data like spam comments, old revisions, and deleted content. This extra data slows down your website.

Database optimization removes this clutter and reorganizes the remaining data for better performance.

  1. Install WP-Optimize Plugin

    • Go to your WordPress admin dashboard
    • Click "Plugins" then "Add New"
    • Search for "WP-Optimize"
    • Install and activate the plugin
  2. Run Basic Optimization

    • Click "WP-Optimize" in your WordPress menu
    • Check these boxes:
      • Remove spam comments
      • Remove unapproved comments
      • Remove post revisions
      • Remove auto-drafts
    • Click "Run optimization"
  3. Schedule Regular Cleanups

    • Go to the "Settings" tab in WP-Optimize
    • Enable "Auto-cleanup"
    • Set it to run weekly
    • Save your settings

Method 2: Manual Database Cleanup

If you prefer not to use plugins, WordPress has built-in settings to limit database bloat:

  1. Limit Post Revisions

    • Contact Web60 support to add this code to your wp-config.php file:
    • define('WP_POST_REVISIONS', 3);
    • This keeps only 3 revisions per post instead of unlimited
  2. Empty Trash Regularly

    • In WordPress admin, go to "Posts" then "All Posts"
    • Click "Trash" to see deleted posts
    • Click "Empty Trash" to permanently delete them
    • Repeat for Pages and Comments

What Gets Optimized?

  • Post revisions: Old versions of your pages and posts
  • Spam comments: Blocked comments from bots
  • Trashed content: Deleted posts, pages, and comments
  • Auto-drafts: Automatically saved drafts you never published
  • Database tables: Reorganized for faster access

How Often Should You Optimize?

Run database optimization monthly if you update your website regularly, or quarterly for websites that change less frequently. Don't optimize daily – it's unnecessary and won't improve performance.

Before You Start

Always create a backup before optimizing your database. Web60 creates automatic backups, but you can also create a manual backup for extra safety.

Database optimization usually takes 1-5 minutes depending on your website size. Your website remains online during the process.

Results You'll See

After optimization, you should notice:

  • Faster page loading times
  • Quicker WordPress admin dashboard
  • Reduced server resource usage
  • Smaller backup file sizes

If your website still runs slowly after database optimization, check our guide on WordPress performance optimization for additional speed improvements.

If you're still stuck with database optimization or see error messages, contact Web60 support through your account portal. We can help troubleshoot any issues or run the optimization for you.

FAQ

Q: Will database optimization delete my content?

A: No, optimization only removes unnecessary data like spam comments and old post revisions. Your published content stays untouched.

Q: How long does database optimization take?

A: Most websites complete optimization in 1-5 minutes. Larger websites with lots of content may take up to 15 minutes.

Q: Can I optimize my database too often?

A: Yes, daily optimization is unnecessary and won't improve performance. Monthly or quarterly optimization is sufficient for most websites.

Q: What happens if something goes wrong during optimization?

A: Web60 creates automatic backups daily, so we can restore your website if needed. Always contact support if you encounter errors.

Q: Do I need technical knowledge to optimize my database?

A: No, the WP-Optimize plugin makes it simple with one-click optimization. Just check the recommended boxes and click run.

Q: Will visitors notice when I'm optimizing the database?

A: No, your website stays online during optimization. Visitors won't see any interruption to your website.

Q: How much space will I save after optimization?

A: Space savings vary, but most websites reduce database size by 10-30%. Websites with lots of spam comments or old revisions save more space.

Last updated: 1 March 2026

Still need help?

Contact our support team for personalised assistance.

Contact Support