We have so many error happen on website (WordPress and Woocommerce) error log and it will show the following error message

WordPress database error Deadlock found when trying to get lock; try restarting transaction for query DELETE FROM wp_options WHERE option_name LIKE '_transient_wpseo_sitemap_cache_shop_order_%' OR option_name LIKE '_transient_timeout_wpseo_sitemap_cache_shop_order_%' made by require('wp- blog-header.php'), require_once('wp-includes/template-loader.php'), include('/themes/themename/template/template-name.php'), WC_Abstract_Order->update_status, wp_update_post, wp_insert_post, clean_post_cache, clean_object_term_cache, do_action('clean_object_term_cache'), call_user_func_array, wpseo_invalidate_sitemap_cache_terms, wpseo_invalidate_sitemap_cache, WPSEO_Utils::clear_sitemap_cache

But I don't know why it is happening. I create this template for special operation, and in that template I didn't use get_header(), get_footer() etc

And _transient_wpseo_sitemap_cache_shop_order_% is made by yoast plugin , but I already do not follow instruction for that page

enter image description here

Could any one tell what is the reason for this ?

Also when I install Delete Expired Transients plugin it will show very large number of Expired transients, could any one tell what happen if I delete this expired transient?

Why transient come in my newly created page and template ,even i didn't use get_header(), get_footer() ?

How to disable this future in selected pages ?

  • This issue is becoming specific to the third party plugins you are using. You should contact the plugin authors for support. Also, please do not shout Feb 25, 2016 at 16:18

2 Answers 2


Transient are not always deleted when they expire, and that makes them unpredictable and sometimes a pain. Whenever I work with transients, I add some kind of functionality to delete the transients when something happens, like I delete transients when publishing posts or updating them if the transient was meant to keep data related to posts.

There is no harm in deleting old expired transients, not even newly created ones. Any transient that is necessary or required will be recreated on the next page load. Because transients are a bit more expensive to create, it might slow one page load down if you delete and recreate all transients in one go. Thereafter everything should work normal again


...is there any option to disable all transient in one page or selected pages

No, there is not, and it would be suicide to do that. Most of the transients that are set are done by WordPress by default. WordPress uses these transients to save the results from quite expensive operations. This way, these expensive operations (which will slow your page loads times) do not need to run on every page load, but only once every few days which saves a lot on resources.

As I already stated in a comment, you probably have issues with transients sets by your plugins, in which case you should contact the plugin authors with the relevant debugging info

  • Thank you very much . :) . Could you please tell is there any option to disable all transient in one page or selected pages . Why that error is coming . Please tell .
    – Manu
    Feb 25, 2016 at 15:46
  • Please see my edited question
    – Manu
    Feb 25, 2016 at 15:57
  • In what way do you mean "Transient are not always deleted when they expire"? Do you mean if no one triggers it after it's expired (lack of views)? Essentially it's never "deleted" but replaced if you get my drift but just making sure I get what you mean there as I use transients quite often.
    – Christine Cooper
    Feb 25, 2016 at 18:29
  • @ChristineCooper There is no build in system to delete expired transients, and if these transients aren't renewed, they stay in db for ever. Transients are actually deleted, and not replaced. When a transient expires and it is renewed, the old value is deleted and a new transient is created in db under a new ID. I guess this what you meant with "deleted" ;-) Feb 25, 2016 at 18:37

It is not a popular opinion, but IMO transients should be avoided if you don't have object caching.

What is happening here (and it is mostly a guess) is that you have two simultaneous attempts to write to the options table. I guess one is an insert and the other is deleted and both need the same resources but one prevents the other to gain control of all the resources it needs and wise versa and therefor neither completes.

What you can try to do is use object caching to avoid transients being saved to the DB, or try to give your DB more power in hope that making it faster will prevent this situation from occurring.

  • 1
    Transients can, if used properly, be very useful ;-) Feb 25, 2016 at 18:14
  • Transients are specifically useful for storing share counts.
    – Christine Cooper
    Feb 25, 2016 at 18:26
  • @PieterGoosen, I am waiting to see the use case that shows it. It is a broken caching system that by design do not guaranty it will even work. Sure, if you close your eyes to overlook the failings you can claim it is useful :) Feb 25, 2016 at 18:34
  • @ChristineCooper, why would you limit in time such a storage? Counts usually should be correctly displayed and updated when the thing being counted has mutated. It make no sense to delete the counts every X time just because Feb 25, 2016 at 18:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.