Your WordPress database holds all the critical information such as the posts, links to images, user data, your WordPress settings, and much, much more.
After some time, every website database gets a little bloated. The excess comes from areas like post revisions, deleted posts, tables left behind from deleted plugins, and themes, and an abundance of post comments, most of which will be spam.
Eventually, all this surplus redundant data will harm the speed of your database and therefore the speed of your site and will impact your user experience.
Periodic database optimization will clear this redundant data and keep your database as lean and as fast as possible.
Database maintenance should happen at least once a month on a smaller static site and weekly on a large, busy site.
While it’s a relatively straightforward task, care should always be taken when dealing with the WordPress database and a backup should be made before any maintenance.
There are plenty of plugins that can help maintain a database, and many of these have an auto-schedule option. You can instruct the plug-in to conduct the maintenance at regular intervals.
However, it’s best to ‘be in the room’ when the maintenance has been carried out.
Once you’ve carried out the simple housekeeping, you may then want to look at some tables within your database. The table that you should concentrate on would you would be your wp_options table. The option table stores all the information about your website. However, if a row in the option table is marked for autoload yes every time a page it’s called, that data is loaded.
There may be data loaded that is not necessary, or indeed there could be options data in there from plugins are teams that have long been deleted. This floats your database and slows your site.
What’s needed here is an assessment of all the data that’s being loaded and whether it is actually necessary. And secondly, you need to do a root and branch search of your options table and take out any options pertaining to deleted plugins or themes, where possible.
This exercise alone can slim down your database quite considerably, making it much more efficient.
Database Optimisation - What we can do
Check the site for redundant code from deleted plugins and themes.
Reduce the number of ‘autoload’ items. Run optimisation across the database
Critically – Reduce the size of the database
Schedule optimisation of the database on a weekly basis.