You are here: Re: can you tell me why this causes a deadlock? « MsSQL Server « IT news, forums, messages
Re: can you tell me why this causes a deadlock?

Posted by Erland Sommarskog on 02/04/06 23:52

Joe Weinstein (joeNOSPAM@bea.com) writes:
>> Two sessions:
>>
>> Session 1:
>> BEGIN TRAN
>> insert into joe (c1,c2) values (1,2)
>>
>>
>> Session 2:
>> BEGIN TRAN
>> insert into joe (c1,c2) values (3,4)
>>
>> Session 1:
>> select * from joe
>>
>> Session 2:
>> select * from joe
>>
>> One of the sessions gets a deadlock victim message.
>> thanks,
>> Joe
>
> PS: This doesn't occur with Sybase, which is fairly closely
> related...

Or was. I don't know what Sybase is doing these days. But neither would
you get a deadlock on SQL 2005 if you run with snapshot isolation.

And when I think of it, neither would this deadlock on SQL 6.5, as
Session 2 would block already on the INSERT, as it would be on a locked
page...


--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация