473,387 Members | 1,863 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,387 software developers and data experts.

A simple question:whether deadlcok will occur if db only select andthers is no lock for reading

it is a common question,not for db2,thank u very much
Dec 3 '07 #1
3 2137
<db*******@gmail.comwrote in message
news:72**********************************@b40g2000 prf.googlegroups.com...
it is a common question,not for db2,thank u very much
When you do a select, there is a share lock, which could be part of a
lockwait or deadlock scenario if there are the right combination of other
exclusive locks (insert, update, delete, select for update, or certain
utililities).

Share locks by themselves, even if they occur from many applications on the
same row, do not conflict with eachother and cannot cause a lockwait or
deadlock situation without some other insert, update, delete, select for
update.

Not all databases work the same way in this regard, so the above applies to
DB2.
Dec 3 '07 #2
thanks.
so your mean that only selecting will not cause deadlock using
db2,even there is a share lock
i know that there is no lock if only select records using oracle.
On Dec 4, 4:44 am, "Mark A" <nob...@nowhere.comwrote:
<db2db2...@gmail.comwrote in message

news:72**********************************@b40g2000 prf.googlegroups.com...
it is a common question,not for db2,thank u very much

When you do a select, there is a share lock, which could be part of a
lockwait or deadlock scenario if there are the right combination of other
exclusive locks (insert, update, delete, select for update, or certain
utililities).

Share locks by themselves, even if they occur from many applications on the
same row, do not conflict with eachother and cannot cause a lockwait or
deadlock situation without some other insert, update, delete, select for
update.

Not all databases work the same way in this regard, so the above applies to
DB2.
Dec 4 '07 #3
db*******@gmail.com wrote:
so your mean that only selecting will not cause deadlock using
db2,even there is a share lock
A share lock means that the resource being locked can be accessed by
different transactions together, i.e. they can "share" the resource.

Note, however, that some applications append the FOR UPDATE clause to SELECT
statements that do not explicitly contain FOR READ ONLY. This is a really
bad idea but not something that can easily be changed. (PHP is a good
example here.)

--
Knut Stolze
DB2 z/OS Utilities Development
IBM Germany
Dec 5 '07 #4

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

Similar topics

0
by: Paul Moberg | last post by:
MySQL 4.0.13-nt I have a table: CREATE TABLE state_county ( StCo_key bigint(20) NOT NULL auto_increment, State varchar(255) NOT NULL default '', County varchar(255) NOT NULL default '',...
4
by: DBC User | last post by:
Hi, I feel so stupid to ask this question, but here it goes When I select a column from a table, if the column has a null value I want the select to return me a blank. I have done this before...
1
by: Ryan | last post by:
I've just inherited a system and have some concerns about the speed of connections to a remote server (SQL2000). If I do a simple select statement on the table below, it takes 14 minutes to retrive...
9
by: Mike R | last post by:
Hi, I cant figure out how to do this.... for example: Select name from mytab order by col1 could return Mike
1
by: elubin_nospam | last post by:
How do I ensure that I always get back 1 row for a query, even if the table doesn't have any rows? For example, table T1 is empty. I would always like the data from t1 if it exists. select c1...
4
by: michael.schmitz | last post by:
We have developed a large PHP application using adodb-4.22, php-4.2.2 and IBM DB2 v8.2 and saw that simple select statements in our code like Execute('select * from sesys.role order by role_id')...
6
by: Spam Catcher | last post by:
Does anyone know why this doesn't work: Select Case X Case X or Y msgbox("hello world!") End Select It seems X or Y doesn't evaluate correctly (I think only the first 1/2 is
1
by: ramiroe | last post by:
hello everyone, I have a simple question I think. I am trying to read from a file, but I am kind of a begginer in this so I need a liitle help. Help in how to read from a file, and then the list of...
4
by: Cyprus106 | last post by:
I'm just trying to order some data correctly. In that respect, I've got the following SELECT statement... SELECT * FROM BKMASTER WHERE MATKEY='MCCOECO' ORDER BY MEDSTA ASC The thing is, there...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...

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.