473,404 Members | 2,114 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

Lock Situation with a special Sql-Statement

Hi,

I have a problem with a special sql-statement. Perhaps somebody could help
me or explain the behaviour of the DB2.

My configuration : IBM DB2 V8.1.5 / Windows 2000 Server

The SQL-Statement :
Select * from PROF.WH_EINZELPROFIL
where lagerstrangid in
(select lagerstrangid from prof.wh_kr_l20_ag where
AGAKTUELL in(3190,3199) AND ZIELNAME NOT IN ('PBF','WBF','ASGF','APMA'))
FOR UPDATE WITH RS

I some situations the result-set of the internal Select-Statement (select
lagerstrangid ...) is empty and in order to that also the result-set of the
whole sql-statement is empty. But the sql-statement locks all records in the
table WH_Einzelprofil with an Update-Lock. I can't understand that behavior
?

The relation WH_Einzelprofil is keyed by an EinzelprofilID, but have also an
index on LagerstrangID.

Can anybody help me ?

Michael
Nov 12 '05 #1
1 1894
"Michael Welp" <we**@meyerwerft.de> wrote in message
news:co**********@news.dtag.de...
Hi,

I have a problem with a special sql-statement. Perhaps somebody could help
me or explain the behaviour of the DB2.

My configuration : IBM DB2 V8.1.5 / Windows 2000 Server

The SQL-Statement :
Select * from PROF.WH_EINZELPROFIL
where lagerstrangid in
(select lagerstrangid from prof.wh_kr_l20_ag where
AGAKTUELL in(3190,3199) AND ZIELNAME NOT IN ('PBF','WBF','ASGF','APMA'))
FOR UPDATE WITH RS

I some situations the result-set of the internal Select-Statement (select
lagerstrangid ...) is empty and in order to that also the result-set of the whole sql-statement is empty. But the sql-statement locks all records in the table WH_Einzelprofil with an Update-Lock. I can't understand that behavior ?

The relation WH_Einzelprofil is keyed by an EinzelprofilID, but have also an index on LagerstrangID.

Can anybody help me ?

Michael

If the subselect does a tablespace scan it locks all the rows. You could try
CS isolation level, instead of RS. There is also a registry (db2set) setting
to only lock the rows that qualify in the predicate, but I don't remember
what it is.
Nov 12 '05 #2

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

Similar topics

1
by: Jake | last post by:
I have a deadlock situation, part of the problem looks like this; spid ecid dbid ObjId IndId Type Resource Mode Status ------ ------ ------ ----------- ------ ----...
5
by: Robin Tucker | last post by:
Hi, I need to lock a table so that Inserts are prevented as well as deleted and updates. At present I'm thinking this might do it: SELECT * FROM myTable WITH(UPLOCK) but then again I'm...
3
by: xixi | last post by:
can someone explain to me what is internal p lock, internal s lock, internal v lock? when i have IS lock or IX lock , i always have these internal locks together for the application handle ...
9
by: Lara | last post by:
Hello freaks, we have many problems with our online reorg and no idea how to resolve it. We had to do an online reorg beacause of 24 h online business. We start the reorg-statements (table by...
5
by: chintalas | last post by:
Here when many users are trying to update the same table the dead lock situation is arising. I like to know how i can put a lock at record level in my table, so that the dead lock situation will...
1
by: pike | last post by:
DB2 8.1 FP7a on AIX 5.2. $ db2 SET CURRENT LOCK TIMEOUT NOT WAIT DB20000I The SQL command completed successfully. $ db2 values current lock timeout 1 ----------- 0
5
by: Marco van de Voort | last post by:
Hi, does sb recognize (aspects of) the following problem? Or better, know a solution or direction to search? At work I've inherited a series of delphi applications that access a common...
2
by: Roopesh | last post by:
Hi, In my mod_python project I am using mysql as the database. There is table card in which unique cards are stored. When a user request comes he has to get a unique card. In this situation I want...
94
by: Samuel R. Neff | last post by:
When is it appropriate to use "volatile" keyword? The docs simply state: " The volatile modifier is usually used for a field that is accessed by multiple threads without using the lock...
11
by: fritzcwdev | last post by:
I have a class as follows: public class OperationFeedback { DateTime _startTime; public DateTime StartTime { get {
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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
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...
0
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...

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.