[Original] search for the original MySQL deadlock ID

Source: Internet
Author: User
If a deadlock occurs, how can this problem be solved? Find the original lock ID and KILL the thread that has been held all the time. But how can we find the thread ID that causes the deadlock among many threads? Since MySQL has developed

If a deadlock occurs, how can this problem be solved? Find the original lock ID and KILL the thread that has been held all the time. But how can we find the thread ID that causes the deadlock among many threads? Since MySQL has developed

If a deadlock occurs, how can this problem be solved? Find the original lock ID, and KILL the thread that has been held for a long time. The server space, but how can we find the thread ID that causes the deadlock? MySQL has been very powerful since its development. This problem is well solved. Directly link the data dictionary for search.

Let's demonstrate it.


Thread A, which is used to lock some records. Suppose this thread has never been committed, or forget to commit. It will always exist, but only the SLEEP status is displayed in the data.

Thread B, which is used for normal updates and website space, but has encountered a problem. At this time, I don't know which thread has locked this line of records?

The information above is huge, and you cannot see where it is.

But now, we only need to extract this part of information from the data dictionary.

It turns out that thread 16 has forgotten the COMMIT.

This article is from "God, website space, let's see it !" Blog, please keep this source

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.