How to clean huge wp_options in SQL - Transients, wpseo_sitemap_cache_validator

WordPress is a fairly light CMS for web servers. Requirements minimum hardware resources and a web server with support HTTPS which we have installed: PHP, MySQL, Nginx or Apache.
Problems in WordPress may occur when we use various modules (plugins) that have security breaches or are not optimized affect the database. Most of the time, the table wp_options he is the one who suffers.

One such scenario is one in which various modules do not delete cache entries or expired transients from MySQL. Wp_ tableoptions it reaches a very large volume in time, which causes a consumption of resources CPUUnjustifiably high RAM. Under these conditions the loading time of a website with WordPress it increases a lot or it can lead to major functionality problems.

Over time we have identified two modules that due to the lack or incorrect operation of the CRON service, expired SQL entries (cache and transients) remain and populate the database in very large numbers.

Huge SQL Table wp options
Huge SQL Table

740 MB for table wp_options it is very big and unjustified at the same time. In a table where the core settings are normally saved WordPress and installed modules.

How to delete from MySQL wp_options lines wpseo_sitemap_cache_validator?

In older versions of Yoast SEO there was a bug that caused the old cache entries for the sitemap to remain in the database, in the wp_ tableoptions, even if they were no longer relevant and should normally have disappeared. To be deleted.

I discovered in MySQL a significant number of lines wpseo_sitemap_cache_validator occupying a useless spire.

wpseo sitemap cache validator
wpseo sitemap cache validator

Deleting these lines from the database is not a risk, but it is recommended that you make a backup before any command executed in SQL.
To delete wpseo_sitemap_cache_validator lines from wp_options just select the database and run the SQL command:

DELETE FROM wp_options WHERE option_name LIKE ('%\wpseo_sitemap\_%')

How to delete expired WooCommerce Transients from SQL - wp_options

Transitions (WordPress Transients) are used by plugins and themes to temporarily store information in the database. This optimizes the loading speed of the site and makes possible the correct operation of some elements.

Normally, expired transients should be automatically deleted from the database, but this does not always happen. Modules such as Facebook and WooCommerce create a lot of transients, and if they are not deleted automatically, they will significantly populate the database. Scenario in which we have to intervene and delete them manually.

We go to the database, to SQL and execute the command line:

DELETE FROM wp_options WHERE option_name LIKE ('%\_transient\_%')

If a large number of transients has been deleted, we will immediately notice a higher loading speed of web pages and a lower CPU consumption for SQL processes.

Passionate about technology, I like to test and write tutorials about operating systems macOS, Linux, Windows, about WordPress, WooCommerce and configure LEMP web servers (Linux, NGINX, MySQL and PHP). I write on StealthSettings.com since 2006, and a few years later I started writing on iHowTo.Tips tutorials and news about devices in the ecosystem Apple: iPhone, iPad, Apple Watch, HomePod, iMac, MacBook, AirPods and accessories.

Leave a Comment