473,792 Members | 2,807 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Update Deadlocks on Primary Key index

1 New Member
We're getting numerous deadlocks in a multi-user system where users are coming in and updating their own data.

In our troubleshooting/traces, the deadlocks seem to be coming from lock contention on a Primary Key Clustered Index, not on the table itself.

Also, from what we can see, the application is requesting multiple locks on the Primary Key Index as it proceeds to perform the update on the primary table.

Can anybody shed some light on this?
The output from the sp_lock procedure below shows multiple page-level
locks being acquired on the Primary Key Index during a Row update,
(all by the same SPID). Although the output below doesn't show any
WAIT status locks, usually we encounter several, and subsequently
have deadlocks. In addition, usually the lock mode being requested
is IX - for intent exclusive, just before a final 'X' mode lock being acquired -
presumably to update the index?

I'm not sure I understand why the index would even need updating?


spid dbid ObjId IndId Type Resource Mode Status
------ ------ ----------- ------ ---- ---------------- -------- ------
51 7 0 0 DB S GRANT
52 7 0 0 DB S GRANT
52 7 0 0 DB S GRANT
52 7 0 0 DB S GRANT
52 7 0 0 DB S GRANT
52 7 0 0 DB S GRANT
52 7 397244470 1 PAG 1:462530 IX GRANT
52 7 397244470 0 TAB IX GRANT
52 7 397244470 3 KEY (5600524a83f4) X GRANT
52 7 397244470 4 KEY (e7007b1049f1) X GRANT
52 7 397244470 1 PAG 1:460575 IX GRANT
52 7 397244470 1 PAG 1:104507 IX GRANT
52 7 397244470 1 PAG 1:93918 S GRANT
52 7 397244470 1 PAG 1:93919 S GRANT
52 7 397244470 1 PAG 1:93920 S GRANT
52 7 397244470 1 PAG 1:93921 S GRANT
52 7 397244470 1 PAG 1:93922 S GRANT
52 7 397244470 1 PAG 1:93923 S GRANT
52 7 397244470 1 PAG 1:93924 S GRANT
52 7 397244470 1 PAG 1:93925 S GRANT
52 7 397244470 1 PAG 1:93926 S GRANT
52 7 397244470 1 PAG 1:93927 S GRANT
52 7 397244470 1 PAG 1:93936 S GRANT
52 7 397244470 1 PAG 1:93937 S GRANT
52 7 397244470 1 PAG 1:93938 S GRANT
52 7 397244470 1 PAG 1:93939 S GRANT
52 7 397244470 1 PAG 1:93940 S GRANT
52 7 397244470 1 PAG 1:93941 S GRANT
52 7 397244470 1 PAG 1:93942 S GRANT
52 7 397244470 1 PAG 1:93943 S GRANT
52 7 397244470 1 PAG 1:93944 S GRANT
52 7 397244470 1 PAG 1:93945 S GRANT
52 7 397244470 1 PAG 1:93946 S GRANT
52 7 397244470 1 PAG 1:93947 S GRANT
52 7 397244470 1 PAG 1:93948 S GRANT
52 7 397244470 1 PAG 1:93949 S GRANT
52 7 397244470 1 PAG 1:93950 S GRANT
52 7 397244470 1 PAG 1:93951 S GRANT
52 7 397244470 1 PAG 1:93952 S GRANT
52 7 397244470 1 KEY (2b00467cf4a5) X GRANT
53 4 0 0 DB S GRANT
54 7 66099276 0 TAB Sch-S GRANT
54 7 0 0 DB S GRANT
54 7 0 0 DB S GRANT
54 7 0 0 DB S GRANT
54 7 0 0 DB S GRANT
54 7 0 0 DB S GRANT
55 1 85575343 0 TAB IS GRANT
55 7 0 0 DB S GRANT
57 7 0 0 DB S GRANT
58 4 0 0 DB S GRANT
59 7 0 0 DB S GRANT
62 7 0 0 DB S GRANT
78 7 0 0 DB S GRANT

We can provide more detailed traces and code as needed.

- Peter C
Nov 30 '06 #1
0 1796

Sign in to post your reply or Sign up for a free account.

Similar topics

2
2002
by: Edward | last post by:
SQL Server 2000 Enterprise Edition Access 2000 Front End One of our clients has recently been experiencing problems with an app that has run satisfactorily (though slowly) for some time. To overcome the slowness, they have installed a new server with SQL Server 2000 Enterprise Edition with 'Log Shipping' enabled (to provide a subsidiary database on which reports can be run) but although the speed issue is resolved, there are hitherto...
9
9112
by: David Berman | last post by:
I'm having a problem with an update operation in a stored procedure. It runs so slowly that it is unusable, unless I comment a part out in which case it is very fast. However, I need the whole thing :). I have a table of email addresses of people who want to get invited to parties. Each row contains information like email address, city, state, country, and preferences for what types of events are of interest. The primary key is an...
1
3845
by: M Wells | last post by:
Hi All, I have a database that is serving a web site with reasonably high traffiic. We're getting errors at certain points where processes are being locked. In particular, one of our people has suggested that an update statement contained within a stored procedure that uses a where condition that only touches on a column that has a clustered primary index on it will still cause a table lock.
16
17021
by: Philip Boonzaaier | last post by:
I want to be able to generate SQL statements that will go through a list of data, effectively row by row, enquire on the database if this exists in the selected table- If it exists, then the colums must be UPDATED, if not, they must be INSERTED. Logically then, I would like to SELECT * FROM <TABLE> WHERE ....<Values entered here>, and then IF FOUND UPDATE <TABLE> SET .... <Values entered here> ELSE INSERT INTO <TABLE> VALUES <Values...
7
19393
by: robert | last post by:
i need to update a column which is a member of the PK on this table. there are some thousands of rows to be updated, many more thousand already in the table. so, i get a constraint violation doing a simple set col1 = 'x' where col1 = 'y' attempted (in general terms; col1 & col2 are the PK)
7
2581
by: Steve B. | last post by:
Does anyone know why the DA Update() would throw an exception? I moved the database but I updated the Conn and the DA, currently (trying)removing/replacing DS. Is there a another direction I should be looking in? Does it matter if I move columns in the grid (everything is a string anyways)? Does the DS need to be udated from the DT? *************** int rowNo = dg.CurrentRowIndex; dt = dt .Rows.BeginEdit();
1
3690
by: Grant McLean | last post by:
Hi First a simple question ... I have a table "access_log" that has foreign keys "app_id" and "app_user_id" that reference the "application_type" and "app_user" tables. When I insert into "access_log", the referential integrity triggers generate these queries: SELECT 1 FROM ONLY "public"."application_type" x
20
18388
by: Mark Harrison | last post by:
So I have some data that I want to put into a table. If the row already exists (as defined by the primary key), I would like to update the row. Otherwise, I would like to insert the row. I've been doing something like delete from foo where name = 'xx'; insert into foo values('xx',1,2,...);
3
28661
by: jbutler8192 | last post by:
Hello. We have a multi-user Java application that can connect to either a UniVerse database or a DB2 database on an AS400 through JDBC. The program executes a SELECT ... FOR UPDATE statement. When connected to the UniVerse database, if a second user runs the program, at the point where the selection executes, the program waits on the lock until the first user's updates are committed. However, when connected to the DB2 database, in the...
0
9670
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9518
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10159
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10000
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6776
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5436
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5560
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4111
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2917
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.