Transient options being created by WC
-
What is WooCommerce doing by creating transient options in the database at a rate of 50/hr? They don’t seem to get deleted automatically so they end up bloating the database and hogging resources and bring the site to a crawl.
-
In maintenance mode WooCommerce accumulates about 50 transient options per hour. In Live mode WooCommerce accumulates well over 1000 transient options per hour with all countries blocked except USA. With other countries accessing the site the accumulation is significantly higher.
What is the best way to manage this?
One suggestion I found was to instruct robots not to hit the add-to-cart in your robots.txt file. This seems to have only marginally helped.
Transients are used for 2 things;
1. Caching product data (per product there will be several)
2. Caching catalog queries e.g. layered navYes they can grow based on visits and # of products, but this is more efficient than doing a query per page load per user. They will be flushed periodically.
Mine don’t seem to flush. Or they grow faster than they flush. I was over 500,000 transient options and my site was grinding to a halt. If I delete transient options manually does that also delete customer cart data?
Is there any way to slow the number of transient options generated from robot visits?
Transients are separate from carts, but they are both stored in the same table.
Robot visits should not matter, because the cache will be valid for them and normal users.
Were the rows all transients, or carts too? We do have an alternative cart system..
I think they were all transients or at least most of them. They were cleared with the following query: DELETE FROM
wp_optionsWHEREoption_nameLIKE (‘%\_transient\_%’) I am also using WP-Optimize to clear transient options.Once I added a line to the robots.txt file not to hit the add-to-cart it seemed to slow down the accumulation a bit.
I also used country blocking to stop Baidu and Ahrefs from spidering. That seems to have slowed down the accumulation quite a bit more.
I am mainly concerned whether deleting transient options on a regular schedule will also delete any customer cache data as well.
It shouldn’t. You can use https://github.com/kloon/woocommerce-large-sessions to be sure it won’t. We’re looking for feedback on that for possible core inclusion.
The topic ‘Transient options being created by WC’ is closed to new replies.