![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi When does DB2 go for an IS (Intent Share) lock? IS mode is defined as a mode in which "The lock owner can read data in the locked table, but cannot update this data. Other applications can read or update the table." Why are concurrent applications allowed to update the table but the lock owner is not? In a normal SELECT query, it is observed that DB2 goes for NS (Next Key Share) locks on the selected rows and an IS lock on the table. What is the significance of the IS lock here? Thanks Praveen |
#3
| |||
| |||
|
|
"praveen" <pillai.prav... (AT) gmail (DOT) com> wrote in message news:1191452726.344050.299530 (AT) w3g2000hsg (DOT) googlegroups.com... Hi When does DB2 go for an IS (Intent Share) lock? IS mode is defined as a mode in which "The lock owner can read data in the locked table, but cannot update this data. Other applications can read or update the table." Why are concurrent applications allowed to update the table but the lock owner is not? In a normal SELECT query, it is observed that DB2 goes for NS (Next Key Share) locks on the selected rows and an IS lock on the table. What is the significance of the IS lock here? Thanks Praveen This prevents someone else from getting an exclusive lock on the table, either from lock escalation of multiple exclusive row locks, or from an explicit lock table statement (in exclusive mode). Multiple IS locks on the same table are OK and do not interfere with each other. You worry too much. |
#4
| |||
| |||
|
|
Hi Mark, Thanks for your response. A few queries - 1. As per the definition provided on the IBM DB2 website, if a particular application has an IS lock on a table, other applications can read or update the table. But as per your answer, someone else cannot get an exclusive lock on the table (which is needed for update). This seems contradictory. Am I missing something here? 2. Can multiple NS row locks cause an escalation to a table lock? We are facing a production scenario with sufficient number of deadlocks/timeouts. So your help will be greatly appreciated. Thanks Praveen On Oct 3, 11:03 pm, "Mark A" <nob... (AT) nowhere (DOT) com> wrote: "praveen" <pillai.prav... (AT) gmail (DOT) com> wrote in message news:1191452726.344050.299530 (AT) w3g2000hsg (DOT) googlegroups.com... Hi When does DB2 go for an IS (Intent Share) lock? IS mode is defined as a mode in which "The lock owner can read data in the locked table, but cannot update this data. Other applications can read or update the table." Why are concurrent applications allowed to update the table but the lock owner is not? In a normal SELECT query, it is observed that DB2 goes for NS (Next Key Share) locks on the selected rows and an IS lock on the table. What is the significance of the IS lock here? Thanks Praveen This prevents someone else from getting an exclusive lock on the table, either from lock escalation of multiple exclusive row locks, or from an explicit lock table statement (in exclusive mode). Multiple IS locks on the same table are OK and do not interfere with each other. You worry too much. |
#5
| |||
| |||
|
|
On Oct 4, 11:30 am, praveen <pillai.prav... (AT) gmail (DOT) com> wrote: Hi Mark, Thanks for your response. A few queries - 1. As per the definition provided on the IBM DB2 website, if a particular application has an IS lock on a table, other applications can read or update the table. But as per your answer, someone else cannot get an exclusive lock on the table (which is needed for update). This seems contradictory. Am I missing something here? 2. Can multiple NS row locks cause an escalation to a table lock? We are facing a production scenario with sufficient number of deadlocks/timeouts. So your help will be greatly appreciated. Thanks Praveen On Oct 3, 11:03 pm, "Mark A" <nob... (AT) nowhere (DOT) com> wrote: "praveen" <pillai.prav... (AT) gmail (DOT) com> wrote in message news:1191452726.344050.299530 (AT) w3g2000hsg (DOT) googlegroups.com... Hi When does DB2 go for an IS (Intent Share) lock? IS mode is defined as a mode in which "The lock owner can read data in the locked table, but cannot update this data. Other applications can read or update the table." Why are concurrent applications allowed to update the table but the lock owner is not? In a normal SELECT query, it is observed that DB2 goes for NS (Next Key Share) locks on the selected rows and an IS lock on the table. What is the significance of the IS lock here? Thanks Praveen This prevents someone else from getting an exclusive lock on the table, either from lock escalation of multiple exclusive row locks, or from an explicit lock table statement (in exclusive mode). Multiple IS locks on the same table are OK and do not interfere with each other. You worry too much. You might be observing lock escalations due to unavailability of sufficient memory for any new locks. Two primary parameters that control lock memory is 'locklist' and 'maxlocks'. Both are DB CFG. What are your values. Make sure you have a high enough value for MAXLOCKS (40-60) and then increase locklist by 20% till your escalation messages go away. Deadlocks can be because of several reasons. You can dig into details only after you have got rid of all lock escalations. Basically, applications are now holding locks larger than they require. After your lock escalation problems are sorted out, turn db2 deadlock event monitor and start analyzing individual situations. It is normal and expected to have infrequent deadlocks in any database. Don't be alarmed if you see a few every now and then. ~sanjuro- Hide quoted text - - Show quoted text - |
#6
| |||
| |||
|
|
1. As per the definition provided on the IBM DB2 website, if a particular application has an IS lock on a table, other applications can read or update the table. But as per your answer, someone else cannot get an exclusive lock on the table (which is needed for update). This seems contradictory. Am I missing something here? |
#7
| |||
| |||
|
|
praveen wrote: 1. As per the definition provided on the IBM DB2 website, if a particular application has an IS lock on a table, other applications can read or update the table. But as per your answer, someone else cannot get an exclusive lock on the table (which is needed for update). This seems contradictory. Am I missing something here? If someone updates a row, an exclusive lock on the row is needed - not on the table. -- Knut Stolze DB2 z/OS Utilities Development IBM Germany |
#8
| |||
| |||
|
|
So, if a transaction obtains an IS lock on a table, other transactions can update rows in the table by obtaining exclusive row locks but they cannot obtain a lock on the table? |
#9
| |||
| |||
|
|
On Oct 4, 3:47 pm, Knut Stolze <sto... (AT) de (DOT) ibm.com> wrote: praveen wrote: 1. As per the definition provided on the IBM DB2 website, if a particular application has an IS lock on a table, other applications can read or update the table. But as per your answer, someone else cannot get an exclusive lock on the table (which is needed for update). This seems contradictory. Am I missing something here? If someone updates a row, an exclusive lock on the row is needed - not on the table. So, if a transaction obtains an IS lock on a table, other transactions can update rows in the table by obtaining exclusive row locks but they cannot obtain a lock on the table? |
|
When is this IS lock obtained by DB2? |
![]() |
| Thread Tools | |
| Display Modes | |
| |