• cleverinformatica

    (@cleverinformatica)


    Hi there,

    I am noticing a strange behaviour with my wordpress instalation. On the diagnostics page i get a critical error saying that my website has 48k autoloaded options, sizing arround 1mb. When i actully check for these autoloaded options on mysql with

    SELECT SUM(LENGTH(option_value)) AS total_size
    FROM wp_options
    WHERE autoload = ‘yes’;

    I only get arround 600 autoloaded options and altogether for a size of arround 190kb. My wp_options table has thousands of transients that i use for custom plugins, but these are not autoloaded and do not affect my website performance. Non the less i still get this warning, even if i delete all irrelevant transients and have no clue about what may be causing it.

    Anyone has some idea about what may be tha cause for the warning, and how it may be solved??

    Best regards,

    Sérgio

Viewing 3 replies - 1 through 3 (of 3 total)
  • Eshaan Dabasiya

    (@im3dabasia1)

    Hey @cleverinformatica (Sergio),

    1. If you are using some caching plugin for optimisation, there can be a possibility of cache build up, which gives you these many options in the dashboard. Clean up the cache if possible and then try.
    2. As you mentioned you have custom plugins, If you have the liberty, lets say have some staging platform available to test the site, I’d suggest disable plugins which you doubt might be causing, see if it makes any difference. This can help you debug and shortlist where the problem is.
    3. Another reason can be, WordPress auto loads some of the options if frequently accessed. This can be due to custom theme/plugin. Please review this as well. We have 3 options which we can set for autoload parameter, ie no, yes, auto. So please check how many options you have as ‘auto’. ‘auto’ options can be auto loaded if frequently accessed.

    Please try the above solutions. LMK if you need further help.

    Thank you!

    Thread Starter cleverinformatica

    (@cleverinformatica)

    Hi @im3dabasia1 ,

    Thanks for the support. Already disabled our cache plugin and cleared both wordpress and server cache, and the issue still persistes. When i disable the mentioned plugins/snippets, and clear all database transients the warning persists, but the number reduces significantly. Lastly i ran some queries to verify how many options i have and their respective size and got:

    SELECT COUNT(*) FROM wp_options; 11762
    SELECT SUM(LENGTH(option_value)) AS total_size FROM wp_options; 5308037

    SELECT SUM(LENGTH(option_value)) AS total_size FROM wp_options WHERE autoload = ‘yes’; 192452
    SELECT COUNT(*) FROM wp_options WHERE autoload = ‘yes’; 614

    SELECT SUM(LENGTH(option_value)) AS total_size FROM wp_options WHERE autoload = ‘auto’; 22962
    SELECT COUNT(*) FROM wp_options WHERE autoload = ‘auto’; 66

    SELECT SUM(LENGTH(option_value)) AS total_size FROM cl_options WHERE autoload = ‘no’; 1842728
    SELECT COUNT(*) FROM wp_options WHERE autoload = ‘no’; 9718

    The warnign persists indicating now 1019 autoloaded options that amount to over 1mb, but even if we sum the options set for yes and auto we only get arroung 0.21 mb. Also the sum of all options doesnt amount to the total, for size or number having a small disparity in count but large in size, from arround 2mb to 5 mb, leading to my following question, may the autoload field not be populated for some options??

    Thanks for the help,

    Best regards,

    Sérgio

    Hey @cleverinformatica ,

    I feel you are having lots of option keys in the wp_options table, Consider deleting old transients, transient timeouts, Also analyse the plugins and theme’s code. To see how you have structured your code and how you are using options table to store data.

    The fact that you have few options for true (yes – depreciated), false (no – depreciated), shows you have many options with autoload as null. As suggested in WordPress Docs, options which don’t have any autoload value ie are null. WordPress decides based on the heuristics to load the options based on its internal backend. Reference: Link. So based on this I feel this can be a reason why so many options are loaded.

    We can also do this. Whereever we are adding/updating options we can pass autoload = false if this option is not heavily required in the lifecycle of your site. This would help a lot, also as suggested please consider deleting transients, and transient timeouts, WordPress in its own does not do garbage cleaning for this.

    Lmk If you need any further assistance.

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.