Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 Blocking

Author  Topic 

john.burns
Posting Yak Master

100 Posts

Posted - 2007-04-03 : 13:54:20
when I use these queries:
--which processes are blocked
use master
go
SELECT * FROM dbo.sysprocesses
WHERE blocked <> 0
--which processes are blocking other processes
SELECT * FROM dbo.sysprocesses
WHERE spid IN (SELECT blocked FROM dbo.sysprocesses where blocked <> 0)
--138
--109


returned rows include status =sleeping
why would that be included.?

snSQL
Master Smack Fu Yak Hacker

1837 Posts

Posted - 2007-04-03 : 17:19:16
Lets say you have a connection that starts a transaction then makes a data modification, that data is now locked. Now that connection sleeps until you issue another query on it (give it more work to do).

In the meantime a second connection tries to update data that is locked by the first connection, it cannot do anything until the data is unlocks so it sleeps while waiting for the first connection to unlock the data.

Once you end the transaction on the first connection the second connection cannot do anything so it does nothing (sleeps) and until you give the first one something to do it does nothing (sleeps).
Go to Top of Page
   

- Advertisement -