Wp options keeps growing (WordPress)
Naar navigatie springen
Naar zoeken springen
In autumn 2023, we had the problem that table wp_options
was growing out of proportion. This article is about one specific case where this plays a role, abbreviated as at_en
The problem
Table wp_options
is growing with about 1 GB per minute for each website. Why this is problematic:
- In about 23h, the available 0.5TB on this server is filled up - This is unsustainable
- Server performance seems to suffer significantly
Additional problems
Additional and possible unrelated problems:
- Transients had to be removed from all sites every couple of days, otherwise error would be sent to the web interface (no such errors catched, unfortunately). Transients are stored in
wp_options
- PHP error log (
/var/log/php/error.log
) has been growing at a similar pace aswp_options
Additional information
- The number of rows in
wp_options
is stable around 1,400, but it grows on storage. Maybe stuff gets written and deleted again at high speed?
Transients
- Command
wp transient list
usually hangs and returns no output - After issues command
wp transient delete --all
, transients can be retrieved. However, this stalls after a bit of time - Test size transiensts nl_nl (
wp transient list > file.txt
- 2023.12.06-10:24): When redirected to storage: 26MB. Most of this comes from a couple of lines starting withwc_layered_nav_counts_pa_
followed by the name of various attribute taxonomies - Test size transiensts nl_nl (2023.12.06-14:20): Total file size is 34.2GB, of wich 30.09GB because of a couple of lines that start again with
wc_layered_nav_counts_pa_
Possible causes - Brainstorm
- Maybe transients get upated all the time, causing the table to grow on storage, but not in number of lines. Also: Some fields get really big and that's not something that I have been watching for
- Something related to cron?
- Something related to transients?
- This only happens when WooCommerce is active. When WooCommerce is paused, the problem disappears. Also: WooCommerce introduces a bunch of cron jobs that seem suspicous, including one empty job
- Caching attribute taxonomies through transients?
Brainstorm
- Make mysqldumps of only wp_options, to see if it's indeed some fields that get big
- Con jobs: Try to figure out which job causes this problem
- Retrieve deleted rows from wp_options to see what kind of information it is
- Cron jobs: Check with functions actually exist
- Cron jobs: Remove them and see what happens to table size.
Conclusion - 2023.12.06
For now, the conclusion is that we have the problem described here and Transients Layered Nav Counts problem (WooCommerce).
See also
Sources
---
- https://wordpress.org/support/topic/wp_options-table-growing-fast-in-size/ - Original posting pointing to WP Rocket
- https://kinsta.com/knowledgebase/wp-options-autoloaded-data/ - Good background stuff, including about autoloading
- https://stackoverflow.com/questions/45181753/wordpress-wp-options-has-grown-too-big - No answers