Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Thu, 21 Feb 2003 @ 02:57:09 GMT


     
  <Prev Next>   <<First <Prev Next> Last>>  


Subj:   Re: What is the Difference Between Blocking and Deadlock?
 
From:   Barry Hull

Assume that you have two sessions that are active, session A and session B. If session A has a lock (like in your example a write lock) on a table and session B wants to get also get a write lock on the same table, session B will be "blocked" from obtaining that lock until session A completes it's unit of work. This is a "block". There is no limit that I'm aware of that limits the time frame for this block. Session B could wait seconds, minutes, hours or days until session A releases the lock.

Now, say that session A gets a write lock on a row in table X, then attempts to get a write lock on a row in table Y. Session B had already obtained a write lock on the row in table Y that session A is trying to get. Now, session B is trying to get a write lock on the row in table X that session A already has locked. In this case, both transactions have a resource locked that the other session needs to complete the transaction. Therefore, you have a "deadlock". The system eventually detects this condition (after a certain time period, which I believe is a tunable parameter) and will issue the deadlock message.

Hope that helps.



     
  <Prev Next>   <<First <Prev Next> Last>>  
 
 
 
 
 
 
 
 
  
  Top Home Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 15 Jun 2023