Tagged Questions

A situation caused by two or more processes being unable to proceed (and thus release their locks) because they are blocked by locks on resources held by the other process.

learn more… | top users | synonyms

1
vote
1answer
30 views

How many rows will be locked by SELECT … ORDER BY xxx LIMIT 1 FOR UPDATE?

As was asked on stackoverflow but then for MySQL, I was wondering how this works in PostgreSQL. How many rows get locked when I do a "FOR UPDATE" in combination with a "LIMIT", a "ORDER BY" and some ...
0
votes
0answers
40 views

How to fix deadlock caused by “X” locks on same resource?

I have the following <resource-list>: <resource-list> <keylock hobtid="72058301601677312" dbid="7" objectname="myDatabase.dbo.TableOne" indexname="PK_TableOne" id="lock2c336fb380" ...
4
votes
0answers
98 views

Trace Flag 1222 Not Working?

I have a customer site with two similarly configured 2008r2 SQL Servers "A" and "C". On both servers the trace flags 1204 and 1222 are enabled and DBCC tracestatus shows the following on both ...
1
vote
1answer
52 views

Deadlock detected on CREATE TABLE in PostgreSQL

I'm creating multiple tables asynchronously when I get deadlock detected. Both tables (Table A & B) have FK to one table (Table C) and I get deadlock on relation to Table C. Scripts CREATE TABLE ...
3
votes
2answers
107 views

Insert only deadlocks

We have an application inserting data into a table. Unfortunately, we are getting deadlocks and the deadlocks are coming from inserts only. We are seeing the inserts take key locks in a different ...
5
votes
1answer
88 views

Should an INSERT cause an exclusive lock on a foreign key?

I'm working on a deadlock issue. Process A is doing a simple INSERT into TableA which has a FK to TableB Process B is doing a complicated SELECT on a join that includes TableA and TableB I'll ...
2
votes
0answers
120 views

Why does a simple select query produce a deadlock?

I am trying to analyze randomly occurring deadlock problems on an SQL Server 2008 R2 database. The deadlocks occur in very rare cases when SSRS tries to access one of 5 different stored procedures. ...
0
votes
1answer
123 views

Weird deadlock graph

I got a deadlock graph that I cannot completely understand. This is the deadlock graph xml (table names obfuscated, obviously): <?xml version="1.0" encoding="utf-16"?> <deadlock-list> ...
2
votes
0answers
70 views

Deadlock when CODES table has 41900 rows

I'm having a deadlock accessing the same table from two different jobs. I'm testing it on a SQL SERVER 2012 Enterprise edition. Running SQL Profiler I get this graph: You can find the SQL Server ...
0
votes
0answers
102 views

notification email when deadlock is encountered in alert log,oracle

how to send a notification email when deadlock is encountered in alert log on any node like the deadlocks encounterd below (an alert any time a deadlock is detected in alert log.) Node 1: Mon Sep ...
0
votes
0answers
48 views

InnoDB says I'm in Deadlock when it should not be

I'll do my best to explain the situation. I'm at a complete loss. Preliminaries I'm running a Java Web Application in Tomcat 7.0 using a JDBC Connector to communicate with my MySQL Database. The ...
1
vote
1answer
64 views

InnoDB deadlock with INSERT .. SELECT

I am trying to understand why a deadlock occurs when two workers in parallel are running INSERT .. SELECT queries on a table which has both 1) auto incremented primary key, 2) a unique index on ...
0
votes
2answers
142 views

Getting a Deadlock,

I have this code : public void saveItems(List<Pair<Item, MapleInventoryType>> items, int id) throws SQLException { PreparedStatement ps = null; PreparedStatement pse = null; ...
0
votes
0answers
30 views

Is it possible for a SELECT-only stored procedure to deadlock on itself?

Environment is Microsoft SQL Server 2012. Is it possible for a stored procedure consisting exclusively of SELECT statements to deadlock on itself? That is the report I am getting from a vendor for ...
2
votes
2answers
135 views

Help reading deadlock XML

Even with reading the Bart Duncan blog about reading deadlocks I still struggle with this. I have included the XML from a particular deadlock. <?xml version="1.0" encoding="utf-8" ?> - ...
5
votes
1answer
330 views

Why are U locks required when using Read Committed Snapshot Isolation

I consider myself a beginner at Sql Server locking. My understanding is that when using RCSI, Sql Server doesn't need to issue S locks because it uses row versioning (in most cases). From ...
10
votes
1answer
350 views

Resolving deadlock from 2 tables only related through indexed view

I have a situation where I'm getting deadlocks, and I think I've narrowed down the culprits, but I'm not quite sure what I can do to fix it. This is on a production environment running SQL Server ...
3
votes
2answers
231 views

Deadlock with simple queries in sql server 2008

I have an application that must delete and insert registries from a table, the table is storing the historic registries for an access control and is stored with the datetime for the check in the ...
0
votes
0answers
39 views

Innodb Deadlock During Insert

What could be the reason behind 2 inserts causing a deadlock? Here is what I get from log file: *** (1) TRANSACTION: TRANSACTION 6CA06B9, ACTIVE 6 sec inserting mysql tables in use 1, locked 1 LOCK ...
1
vote
0answers
68 views

Ordering a sequence of INSERT…SELECT statements to avoid a deadlock

I have the following two tables in a MySQL database: CREATE TABLE `names` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(60) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY ...
1
vote
1answer
49 views

Deadlock while updating rows and inserting new ones

I'm working with SQL Server 2012 Express Edition and I getting this error: Transaction (Process ID 53) was deadlocked on lock resources with another process and has been chosen as the deadlock ...
4
votes
1answer
207 views

Optimizing concurrent updates in Postgres

I'm running concurrent Postgres queries like this: UPDATE foo SET bar = bar + 1 WHERE baz = 1234 Each query affects the fixed K number of rows, and I can't find a way to enforce the order in which ...
1
vote
0answers
316 views

exec sp_getapplock - Different behaviour using go or without go

we have a strange behaviour while using sp_getapplock (we tried to use this to solve a problem with a deadlock involving some insert while another session was trying to execute a ALTER SWITCH ...
1
vote
1answer
80 views

TRUNCATE in transaction: dead lock

In a unittest we run this: BEGIN; TRUNCATE table1; TRUNCATE table2; ... UPDATE ...; ROLLBACK; Unfortunately this results in a dead lock if a cron job starts and this job operates on table1 and ...
4
votes
0answers
386 views

SQL Server Deadlock - Two SELECT Exclusive Locks on Exact Same Index and Key [closed]

How is the deadlock graph below possible? How did two SELECT statements simultaneously acquire an exclusive lock on the exact same resource? The exclusive locks were on the primary key index for ...
7
votes
1answer
479 views

Deadlock on Delete Statement

I get a deadlock when a SQL Server Job runs. The deadlock occurs on a simple DELETE statement. I would have thought there would have to be a SELECT/UPDATE query running to cause the deadlock? But ...
0
votes
1answer
96 views

Is UDPLOCK using Row-locks?

I have a UPDATE statement that is using a UPDLOCK inside a DTCTransaction to avoid deadlocks. Now I was wondering. is it locking on a Row-level or on a Table-level?
3
votes
0answers
47 views

Update+Select in one SQL Server transaction, and concurrent deadlocks [duplicate]

I have a problem with a transaction isolation or concurrent atomic select+update. SQL Server, C++ application, OTL/ODBC, and I can't use any stored procedures. Here is the thing. The task is to ...
-1
votes
0answers
41 views

Query Deadlock on Select Query [closed]

I have 2 queries deadlocking on each other. The first query is Select Top 1 NULL From [Table1] with (HOLDLOCK, TABLOCKX) Second Query is an insert query that only reads from [Table2] to put data ...
0
votes
0answers
133 views

Avoid transaction rollback when Deadlock is encountered (mysql)

I'm currently trying to handle concurrent inserts correctly using MySQL, I'm basically doing the following: CREATE TABLE foo (id INT NOT NULL PRIMARY KEY) ENGINE=INNODB; CREATE TABLE bar (id INT NOT ...
2
votes
2answers
346 views

Amazon rds MySql -> concurrent connections deadlocks

I normally hang around in StackOverflow but I think this issue is better suited here. I've built an application in C#.NET that uses MySql as a database. My application inserts and updates data in the ...
1
vote
0answers
61 views

Multi-victim deadlock in SQL Server

I have been seeing a lot of deadlocks occurring on a system with deadlock graphs similar to this one: I have been advised that it is a multi-victim deadlock but I cannot re-create a deadlock graph ...
1
vote
0answers
105 views

What do spikes in InnoDB lock structures indicate?

I co-maintain a high traffic site similar to StackExchange. It runs MySQL 5.1 (working on replacing it with MySQL 5.5 or MariaDB). All our tables are InnoDB. MySQL goes down a couple of times a day. ...
1
vote
2answers
105 views

Changing two publications at the same time causes deadlock in distribution database

I have transactional replication setup. Let's say three databases on server A replicate to corresponding three databases on Server B. The databases are identical (same structure for different ...
0
votes
1answer
210 views

MySQL: Transaction and Deadlock

I have table "tbl_data", where have a lot of rows (3 - 5 million). I have JAVA (*.jar) module from which I INSERT/UPDATE data into this table. If I start *.jar file (for example, "run.jar") and after ...
4
votes
1answer
288 views

Side effects of using updlock lock hint?

I was just exploring UPDLOCK hint in SQL-Server 2008 and I found it is very useful in avoiding certain deadlock scenarios. There are always some side effects when using these types of lock hints but I ...
1
vote
1answer
176 views

Deadlock occurring on database, SQL Server 2008R2

Last few days I had major problems with my production site, turns out deadlock occurred, every half an hour maybe 50-60 of them. To do a quick fix in order to keep the site running I set : ...
6
votes
0answers
234 views

Is this a race condition or bug in sql server using serializable TIL with updlock? [closed]

I've been staring at this problem for almost a week now. I'm getting a deadlock in some query, and I've reduced the problem to these reproducible steps: Create a database with: create table offering ...
4
votes
1answer
80 views

How can a connection for one DB block a connection to another DB in SQL Server?

We have an interesting scenario. For weeks, we have been experiencing 'outages' on SQL Server 2008 -- where our websites have slowed to a crawl and mass timeouts for all customers who have DB's ...
5
votes
2answers
356 views

SQL Server 2000 - 'Performance: Deadlock'

We had to restart our SQL Server today, we had made no changes to it. When it came back up we immediately started getting this error from the server DATE/TIME: 2/27/2014 3:09:31 PM ...
2
votes
1answer
101 views

Avoiding Deadlocks

We currently have a trigger-based system in place that does the following: When records in certain tables are modified, a trigger fires that makes a field NULL in a varying number of records in ...
0
votes
1answer
144 views

SQL Server 2008R2 - Stored Procedure with 2 updates causing deadlocks

I have a web api web service that calls an authentication stored procedure. This stored procedure calls a different stored procedure that does 1 update: UPDATE ...
0
votes
0answers
31 views

Why are there more MySQL deadlocks on my 8-core machine than 16-core?

I'm running a bunch of scripts in parallel that do: START TRANSACTION REPLACE INTO... REPLACE INTO... REPLACE INTO... ... COMMIT On my 8-core machine, where 8 of these processes are running in ...
2
votes
1answer
177 views

How to use proper hints for Upsert involving a top 1 subquery

For this specific case (tracking Load Balancer switches) we wish to optimize an Upsert so that it does not exhibit any race conditions, cause any PK violation, or acquire any over sized locks. ...
2
votes
2answers
170 views

Reducing deadlocks with update query hint or other method

I'm getting 20-30 deadlocks per day on the same table. (2 mil rows) Profiler DeadlockGraphs show KEY LOCK and PAGE LOCK (See attched jpg) Total datatype size per row = 114 bytes We have multiple ...
0
votes
0answers
80 views

Mysql Deadlock explanation

I have a problem with reading innodb monitor output. It's seem that problem in gap lock on FK_SESSION_CLIENT_ID index. But i can't simulate this situation on dev host. Transaction isolation level is ...
0
votes
0answers
25 views

Indexing and Deadlock in SQL Server 2008? [duplicate]

I am running into a deadlock in SQL Server 2008. Using profiler I was able to determine that the deadlock happens as I am trying to select and update row(s) in table in 2 different sessions. The ...
4
votes
1answer
240 views

Stored procedure deadlocking itself

I have a strange situation, seen from the log: Process 37278 waits for ExclusiveLock on advisory lock [16421,999999,12864385,2]; blocked by process 53807. Process 53807 waits for ExclusiveLock on ...
1
vote
1answer
526 views

How does locking work in INSERT..ON DUPLICATE KEY UPDATE statements?

I am encountering deadlocks while trying to update multiple rows (a batch) using INSERT..ON DUPLICATE KEY UPDATE. Does MySQL lock all the rows in one batch or does it lock only the row it is updating ...
0
votes
0answers
314 views

Single DELETE statement deadlocking in Sybase ASE

I've got a fairly straightforward process running on ASE 15.7, that creates rows in two tables and later deletes them. The tables are both configured to use datapages for the locking scheme, and the ...