473,503 Members | 479 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DB2 IS (Intent Share) Locks

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

Oct 3 '07 #1
7 6471
"praveen" <pi************@gmail.comwrote in message
news:11**********************@w3g2000hsg.googlegro ups.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.
Oct 4 '07 #2
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...@nowhere.comwrote:
"praveen" <pillai.prav...@gmail.comwrote in message

news:11**********************@w3g2000hsg.googlegro ups.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.

Oct 4 '07 #3
On Oct 4, 11:30 am, praveen <pillai.prav...@gmail.comwrote:
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...@nowhere.comwrote:
"praveen" <pillai.prav...@gmail.comwrote in message
news:11**********************@w3g2000hsg.googlegro ups.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

Oct 4 '07 #4
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
Oct 4 '07 #5
On Oct 4, 3:47 pm, Knut Stolze <sto...@de.ibm.comwrote:
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
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?

Oct 4 '07 #6
"praveen" <pi************@gmail.comwrote in message
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?
That is correct. An exclusive lock on a table only occurs when someone
issues a lock table statement (exclusive mode), or lock escalation to table
level occurs (for an exclusive lock on a row), or when some DB2 operation
needs an exclusive lock on the table (such as drop table).

The only thing you need to worry about (assuming your programs are not
issuing lock table statements) is lock escalation. This shows up in the
db2diag.log and in database snapshot, so you should be able to tell if this
is happening.
Oct 5 '07 #7
praveen wrote:
On Oct 4, 3:47 pm, Knut Stolze <sto...@de.ibm.comwrote:
>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?
Correct. They cannot obtain an _exclusive_ lock on the table.
When is this IS lock obtained by DB2?
Before the S lock on a row is acquired. The reason is that DB2 must check
that the table does not have an exclusive lock before going to a row and
working on the row. Likewise, if DB2 would set the IS lock after the S
lock, someone else could have locked the table exclusively in between.
Therefore, such hierarchical locks are obtained top-down, i.e. from
database-to-tablespace-to-table-to-page-to-row level.

p.s: Hierarchical locks are standard techniques for database systems (the
internal implementation). You should be able to find a lot of literature
on that.

--
Knut Stolze
DB2 z/OS Utilities Development
IBM Germany
Oct 5 '07 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2067
by: aswinee | last post by:
I am running Microsoft SQL Server 2000 - 8.00.760 Enterprise Edition on Windows 2003 Enterprise Edition (NT 5.2 Build 3790:) I have 4CPU and 8GB of RAM. I have AWE enabled, /pae /3gb switch is on...
17
12781
by: Dr NoName | last post by:
Help! I have a table that multiple processes must be able to write to concurrently. However, it for some reason gets locked in exclusive mode. I narrowed it down to one SQL statement + some...
6
20599
by: John Carroll | last post by:
Is there a SQL query that can be run against a database that will give me all the details on any locks that are in place at the given time? I am interested in find the lock type and owner. Thank...
9
7341
by: Jane | last post by:
Our db2diag.log is full of messages like this: 2004-05-31-17.15.10.383766 Instance:tminst1 Node:000 PID:394948(db2agent (TMDB1) 0) TID:1 Appid:GA140956.EF26.03A4B1202647 data management ...
0
3368
by: Bruce Pullen | last post by:
DB2 v7.2 (FP7 - DB2 v7.1.0.68) on AIX 5.2.0.0. We're seeing unexpected single row (then commit) insert locking behaviour. We're seeing Applications that already hold row-level W locks in...
4
1891
by: Alex Callea | last post by:
Hi there, We have a web application handling thousands of requests per seconds reading sql server data which is heavily updated. We are generally experiencing no performance problems. On some...
22
18763
by: RayPower | last post by:
I'm having problem with using DAO recordset to append record into a table and subsequent code to update other tables in a transaction. The MDB is Access 2000 with the latest service pack of JET 4....
1
2867
by: shenanwei | last post by:
I have db2 v8.2.5 on AIX V5.3 with all the switches on Buffer pool (DFT_MON_BUFPOOL) = ON Lock (DFT_MON_LOCK) = ON Sort ...
1
1844
by: rlwaggs | last post by:
Is there a problem with linked tables in Access causing share locks in SQL server if my SQL Server account has read only permissions? The IT group I work with has a negative view of Access. I use...
0
7282
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7339
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6995
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7463
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5581
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5017
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3168
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3157
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
389
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.