Deadlock, simply take a look

Source: Internet
Author: User

first, how to track the deadlock

Tracking methods See: http://guobaoguo.blog.163.com/blog/static/109162582010112311553185/

I chose the second one, and then I got a part of the trace file.

1. Graphical presentation of SQL Server Profiler

2. Extracted XML data

Ii. deadlock victims victim= "Process98274c8" three, look at the process, resource node

Process

1, process98274c8--report query

2, process9862748--across 3 machines, DTC distributed transactions, long time

Resource

1. Resources used: Table =fa_voucher, Index =pk_fa_voucher,

process9862748 do insert operation, plus exclusive x lock,

PROCESS98274C8 Application Ranges-s Lock, request type wait

2. Resources used: Table =yw_cwdistributioninfo,

Process98274c8 do query, plus share S lock,

process9862748 application six lock, request type Convert, here is not too understanding of convert

3, according to the Lock compatibility mode table to see the above two are conflicting, is also a deadlock

https://msdn.microsoft.com/zh-cn/library/jj856598 (v=sql.120). aspx

Iv. Solutions

1, report query add with (NOLOCK), non-real-time, allow dirty read.

2, later look at the tracking situation, if possible split distributed transactions, instead of message mode

Deadlock, simply take a look

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.