Clean up and optimise WordPress database

If you want a fast website, you need to clean up and optimise WordPress. This optimisation should form part of your quarterly website service alongside checking for Dead Links and Image Optimisation.

The WordPress database stores everything on your website. Posts, Pages, Comments, Plugin Settings, Theme Settings, Media Settings and Revisions all stored in the WordPress database. Over time, this will grow, leading to slower loading times to retrieve information.

Looking for a can of baked beans will take a few seconds if you only have a few cans, but if your cupboard is full, then moving unrequired cans out of the way will take longer.

Optimising WordPress databases will remove this unnecessary data, leading to quicker loading times and a better user experience.

Why WordPress Databases Grow?

A new WordPress installation has 12 core tables.

  1. wp_commentmeta – stores extra information from comments
  2. wp_comments – stores approved and unapproved comments
  3. wp_links – retired but still present for users of older versions of WordPress
  4. wp_options – store’s website settings like site title, tagline, and time zone
  5. wp_postmeta – stores extra information from posts
  6. wp_posts – stores text, revisions, menu items, media attachments, and any custom items.
  7. wp_terms – stores categories for both posts and pages and tags
  8. wp_termmeta – stores descriptions of categories, tags
  9. wp_term_relationships – helps maintain relationships between tables
  10. wp_term_taxonomy
  11. wp_usermeta – stores extra information about users
  12. wp_users – stores the list of all registered users of your WordPress website

Each time you create a new post or receive a comment, a new row is added to the applicable table, plus they will create new tables for plugins and themes.

Unfortunately, many themes and plugins do not remove their database entries when removed. Spam comments and data on unused or removed images will remain.

This site alone has had multiple plugins and themes during the design and testing stages of the site. Leaving us with a large WordPress database.

Please follow our WordPress Backup recipe before cooking

Remove Unused Plugins & Themes

Don’t get caught in the trap of leaving unused themes or plugins deactivated. If your website doesn’t need the plugin on a regular basis, then remove it. That includes the below optimisation plugin. Once you have finished using it, then deactivate and remove. When you come to need it again, then install it.

Comment Best Practices: Prevent Spam

Spam comments are part and parcel of owning a WordPress website, with 43% of the internet using WordPress. Spammers will always find a way. To help prevent spam, you can use plugins like Akismet, WP Cerber Security, CleanTalk and Titan Anti-spam & Security.

Other WordPress Cleanup Recipes

Limit WordPress Post Revisions
Limit how many draft posts WordPress keeps to maintain a healthy database
Check out this recipe
Limit WordPress Post Revisions
Turn off WordPress comments
Turn off comments per page, post or everywhere
Check out this recipe
WordPress Disable Comments

Please follow our WordPress Backup recipe before cooking

Clean Up WP Feature Image

Clean Up and Optimise WordPress Database

Keep your website quick and trim
Computer Time 15 minutes
Total Time 15 minutes

Equipment

  • WordPress

Ingredients  

  • Website
  • Website

Instructions
 

  • Install and Activate WP-Optimize
    Install WP-Optimise
  • From your dashboard left menu select WP-Optimise > Database
    Performance > Database
  • Warning: Items marked with this icon perform more intensive database operations. In very rare cases, if your database server happened to crash or be forcibly powered down at the same time as an optimisation operation was running, data might be corrupted. You may wish to run a backup before optimising.
    WARNING
  • Back on the Optimisations we are going to stick with the default selected optimisations just to be save, if you have UpDraft installed then make sure the tick box for a automatic backup is ticked.
    UpDraft Plus Backup Setting Ticked
  • Press Run all selected optimisations and we are done
    WP-Optimise Run All Selected Optimisations

Struggling with the above recipe? Hire a chef to do it for you