Knowledgebase Home / Clean and Optimize a WordPress Database
// View Comments //

Clean and Optimize a WordPress Database

In this KB Article, we discuss the importance of keeping your WordPress database(s) optimized and clean. The WordPress database stores everything that you need for your website and many things that you don’t.

What can affect database performance?

The frequent addition, deletion and moving data in the database that WordPress uses can make it inefficient. Even though we have an “optimize database” option in cPanel, it is not done automatically.

Every time a new post or page is created or an existing page is edited, WordPress creates a revision of that page or post. It is basically a copy of the contents and is kept in the database even after you publish the post or page. For. e.g. if you edit a post 5 times, you might have 4 copies of that post as revisions. This quickly adds a lot of rarely-used data to the tables, making them unnecessarily bloated and results in slower access times. There may also be a lot of spam and unapproved comments in your comments table which takes your valuable space further slowing down load times.

Even after deleting a plugin/theme from your WordPress website, they can still leave data in the database such as orphaned options, tables, and cron tasks. Not all plugins and themes are good at “leave no trace” after removing them. If you love trying out new themes and plugins frequently, the leftovers will pile up and start influencing the website’s performance.

What can we do?

We need to clean up the database by taking steps like deleting orphaned items such as ‘old revisions’, ‘old drafts’, ‘spammed comments’ and optimizing the database to reduce the database size and improve website load speeds. Keeping the database smaller and optimized also helps to backup and restore databases without any errors.

Yes, keeping the database clean involves much manual work and requires knowledge of WordPress internals and MySQL queries. Fortunately, We have a lot of plugins that can clear out all of this unnecessary data, clean up the tables and retrieve space lost to data fragmentation. Below are some of them.

WP-Sweep

Advanced Database Cleaner

You can find more plugins from the WordPress plugin repository at https://wordpress.org/plugins

Please note that we do not endorse any of these plugins and they might have an incompatibility with other plugins/themes you use. Make sure that you take a backup of the MySQL database to your local machine before running these plugins.

As always, if you have any questions, don’t hesitate to contact us.


If you have any web hosting questions please feel free to reach out to us. We're happy to help.
Shared Hosting | Reseller Hosting | Managed WordPress Hosting | Fully Managed VPS Hosting

Our Guiding Principles

  • Provide consistent, stable, and reliable web hosting services.
  • Ensure rapid ticket response and quick resolutions to issues.
  • Never saturate or over-provision servers to ensure stability and speed for our customers.
  • Use only high-quality enterprise-class hardware to ensure minimal downtime from hardware failures.
  • Provide clear pricing with no hidden fees or gotchas.
Subscribe to comment notifications
Notify of
guest
0 Comments
Inline Feedbacks
View all comments