How to clean huge wp_options in SQL - Transients, wpseo_sitemap _cache_validator

A very useful tutorial if you have a website on WordPress whose SQL table wp_options is very large. Clean huge wp_options in SQL.

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.

How to clean huge wp_options in SQL
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 clean huge wp_options in SQL

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 do we delete transients (WooCommerce Transients) expired 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 it creates 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 have been deleted, we will immediately notice a higher loading speed of the web pages and a lower consumption of CPU for processes put by SQL.

Passionate about technology, I enjoy writing on since 2006. I have a rich experience in operating systems: macOS, Windows, and Linux, as well as in programming languages and blogging platforms (WordPress) and for online stores (WooCommerce, Magento, PrestaShop).

How to » WordPress » How to clean huge wp_options in SQL - Transients, wpseo_sitemap _cache_validator
Leave a Comment