List:General Discussion« Previous MessageNext Message »
From:Suresh Kuna Date:June 16 2011 6:04am
Subject:Re: Query on wait_timeout
View as plain text  
Try this out:-)

Below are the steps to generate a deadlock so that the behaviour of a
deadlock can be illustrated:

-- 1) Create Objects for Deadlock Example
USE TEMPDB

CREATE TABLE dbo.foo (col1 INT)
INSERT dbo.foo SELECT 1

CREATE TABLE dbo.bar (col1 INT)
INSERT dbo.bar SELECT 1

-- 2) Run in first connection
BEGIN TRAN
UPDATE tempdb.dbo.foo SET col1 = 1

-- 3) Run in second connection
BEGIN TRAN
UPDATE tempdb.dbo.bar SET col1 = 1
UPDATE tempdb.dbo.foo SET col1 = 1

-- 4) Run in first connection
UPDATE tempdb.dbo.bar SET col1 = 1

Connection two will be chosen as the deadlock victim


On Thu, Jun 16, 2011 at 10:53 AM, Adarsh Sharma <adarsh.sharma@stripped>wrote:

> How we can create a deadlock manually to test this problem.
>
> Thanks
>
>
> Suresh Kuna wrote:
>
>> Good question Yogesh, I can say the best solution is
>>
>> Create a deadlock and test it, you will come to know more about it.
>>
>> On Wed, Jun 15, 2011 at 3:38 PM, Yogesh Kore <yogeshkore@stripped>
>> wrote:
>>
>>
>>
>>> Hi,
>>>
>>> Small doubt for wait_timeout.
>>>
>>> If my wait_timeout is set for 180 seconds and if any deadlock occures and
>>> both query are waiting to execute. What wil happen in that case?
>>> 1. Do the connection will wait till deadlock is removed or
>>> 2. Connection will close after 180 seconds as both queries are ideal and
>>> waiting for each other.
>>>
>>> Thanks,
>>> Yogesh
>>>
>>>
>>>
>>
>>
>>
>>
>>
>
>


-- 
Thanks
Suresh Kuna
MySQL DBA

Thread
Query on wait_timeoutYogesh Kore15 Jun
  • Re: Query on wait_timeoutSuresh Kuna15 Jun
    • Re: Query on wait_timeoutAdarsh Sharma16 Jun
      • Re: Query on wait_timeoutSuresh Kuna16 Jun
        • Re: Query on wait_timeoutAdarsh Sharma16 Jun
          • RE: Query on wait_timeoutMartin Gainty16 Jun
        • Re: Query on wait_timeoutClaudio Nanni16 Jun