Guy Korland
Guy Korland

Reputation: 9568

DeadLock on Azure SQL Database without transactions

It seems like despite the fact we're not using transactions at all we get random deadlock error from SQL Azure.

Are there no transnational situation when SQL Azure can get into a deadlock?

It seems like when we are running a batch of UPDATE queries it acts like the batch is a one big transaction.

All the updates are by id and update a single a line.

Upvotes: 1

Views: 1675

Answers (2)

Remus Rusanu
Remus Rusanu

Reputation: 294407

There is no such things as "not using transactions". There's always a transaction, wether you start one explicitly or not. Read Tracking down Deadlocks in SQL Database for how to obtain the deadlock graph in SQL Azure. Connect to master and run:

SELECT * FROM sys.event_log
WHERE database_name like '<your db name>'
AND event_type = 'deadlock';

Then analyze the deadlock graph do understand the cause. Most likely you're doing scan because of missing indexes.

Upvotes: 6

Satya_MSFT
Satya_MSFT

Reputation: 1022

When you have concurrent transactions running (either implicit or explicit) you encounter deadlocks. Probably when you you said no transactions that means your transactions are implicit.

Upvotes: 2

Related Questions