RE: Which query is best?

From: Dunbar, Norman <norman.dunbar_at_environment-agency.gov.uk>
Date: Tue, 15 Dec 2009 10:13:25 -0000
Message-ID: <919FC80F27E0C6428106496EDF92A7520A6A4D72_at_EXCCLUS05.PRODDS.NTNL>



Hi Syed,

>> Exactly, we are in the same situation where two or more
>> session waiting for each others, waiting on event 'enq: TX -
>> row lock contention'.

This isn't a deadlock then. See
http://qdosmsq.dunbar-it.co.uk/blog/?p=192 for a description of what happens during a deadlock.

What you definitely have (as described above) is a situation where the session that selects for update is locking out the other session(s) until such time as it commits or rolls back any changes it may have made. Until such time as that happens, the row(s) locked in the select for update will remain locked.

It may be possible, as Stephane has pointed out, that your select locks more than one row in the table. Good advice there and it would be wise to check if this is the case because you may find that you are locking out more than one row and that could be causing your long enqueue waits as you block other sessions that you may not need to block.

Cheers,
Norman.

Information in this message may be confidential and may be legally privileged. If you have received this message by mistake, please notify the sender immediately, delete it and do not copy it to anyone else. We have checked this email and its attachments for viruses. But you should still check any attachment before opening it. We may have to make this message and any reply to it public if asked to under the Freedom of Information Act, Data Protection Act or for litigation. Email messages and attachments sent to or from any Environment Agency address may also be accessed by someone other than the sender or recipient, for business purposes. If we have sent you information and you wish to use it please read our terms and conditions which you can get by calling us on 08708 506 506. Find out more about the Environment Agency at www.environment-agency.gov.uk

Information in this message may be confidential and may be legally privileged. If you have received this message by mistake, please notify the sender immediately, delete it and do not copy it to anyone else.

We have checked this email and its attachments for viruses. But you should still check any attachment before opening it. We may have to make this message and any reply to it public if asked to under the Freedom of Information Act, Data Protection Act or for litigation. Email messages and attachments sent to or from any Environment Agency address may also be accessed by someone other than the sender or recipient, for business purposes.

If we have sent you information and you wish to use it please read our terms and conditions which you can get by calling us on 08708 506 506. Find out more about the Environment Agency at www.environment-agency.gov.uk

--
http://www.freelists.org/webpage/oracle-l
Received on Tue Dec 15 2009 - 04:13:25 CST

Original text of this message