If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Lock Wait Time in Select Query

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-06-03, 01:44
gulshan_gandhi gulshan_gandhi is offline
Registered User
 
Join Date: Jun 2003
Posts: 24
Lock Wait Time in Select Query

Hi,

Is there way a Lock Wait Time can be addd in Select Query (Using table X) so that if there is an insertion going on in the same table X by other process, then the Select Query should not be deadlocked and wait for Lock Wait Time.

There is a strange process happening in the system whereby on doing a SELECT, application is getting a deadlock.

Gulshan
Reply With Quote
  #2 (permalink)  
Old 12-06-03, 02:10
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
You can do the select with isolation level UR (uncommitted Read). Check out the manuals to make sure you understand what that means for the integrity of the data retrieved in the select statement.

Lock wait time can be increased for the database, but not for a particular query (of course if UR is used, there is no locking). To maximize concurrency, have all applications use CS (Cursor Stability isolation level) and perform commits at a reasonable frequency if possible.

Also, when trying to fix a lock contention problem, make sure you understand the difference between a lock time-out, and a true deadlock. Although both are due to lock contention, they are often different in how you resolve them.
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
Reply With Quote
  #3 (permalink)  
Old 12-06-03, 02:23
gulshan_gandhi gulshan_gandhi is offline
Registered User
 
Join Date: Jun 2003
Posts: 24
Thanks Marcus,

Can I get any reference document to the difference between a lock time-out, and a true deadlock

Quote:
Originally posted by Marcus_A
You can do the select with isolation level UR (uncommitted Read). Check out the manuals to make sure you understand what that means for the integrity of the data retrieved in the select statement.

Lock wait time can be increased for the database, but not for a particular query (of course if UR is used, there is no locking). To maximize concurrency, have all applications use CS (Cursor Stability isolation level) and perform commits at a reasonable frequency if possible.

Also, when trying to fix a lock contention problem, make sure you understand the difference between a lock time-out, and a true deadlock. Although both are due to lock contention, they are often different in how you resolve them.
Reply With Quote
  #4 (permalink)  
Old 12-06-03, 03:21
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
There is a good discussion of deadlocks on page 14 of the Administration Guide: Performance (version 8). You should be able to find a good general discussion of locking and isolation levels in the same manual. The DB2 manuals can be downloaded from the IBM website. See the Useful DB2 Stuff thread for a link.
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On