Subject | Transaction / lock conflict on no wait transaction |
---|---|
Author | Robert martin |
Post date | 2008-11-24T19:55:23Z |
Hi
I am getting some lock conflicts. I have looked at my code but cant see
many issues however I wonder if the following could cause a lock error,
and if so what options I might have.
CREATE TABLE BranchSend
(
SendRef BigInt NOT NULL,
RegionRef BigInt NOT NULL,
SendTable VarChar(25),
PkRef BigInt,
PkRef2 BigInt,
PkRef3 BigInt,
TransferBatchRef BigInt,
TransferConfirmed D_Boolean,
CONSTRAINT BranchSend_PK PRIMARY KEY (SendRef)
)
DELETE
FROM Location l
WHERE NOT EXISTS (SELECT bs.SendRef FROM BranchSend bs WHERE
bs.SendTable = ''LOCATION'' AND bs.PkRef = l.LocationRf AND
bs.TransferConfirmed = 'F')
I have a number of SQLs similar to the one above. The purpose is to
delete records from tables (in this case location) where no entries
exist in the BranchSend table that have not been confirmed. There is a
trigger on these tables that then deletes records from BranchSend where
Sendtable and PkRef(s) match.
These SQLs are runin one app that can only have one copy active at a
time. However another app runs (multiple copies) that marks
SendTable.TransferConfimed to 'T'.
Question.
If the DELETE sql is running (in a read / write transaction) and another
write transaction changes SendTable.TransferConfimed to 'T' will that
cause a lock conflict? My guess is yes.
If so do you have any suggestions on how to do it without the lock conflict?
Thanks
Rob
I am getting some lock conflicts. I have looked at my code but cant see
many issues however I wonder if the following could cause a lock error,
and if so what options I might have.
CREATE TABLE BranchSend
(
SendRef BigInt NOT NULL,
RegionRef BigInt NOT NULL,
SendTable VarChar(25),
PkRef BigInt,
PkRef2 BigInt,
PkRef3 BigInt,
TransferBatchRef BigInt,
TransferConfirmed D_Boolean,
CONSTRAINT BranchSend_PK PRIMARY KEY (SendRef)
)
DELETE
FROM Location l
WHERE NOT EXISTS (SELECT bs.SendRef FROM BranchSend bs WHERE
bs.SendTable = ''LOCATION'' AND bs.PkRef = l.LocationRf AND
bs.TransferConfirmed = 'F')
I have a number of SQLs similar to the one above. The purpose is to
delete records from tables (in this case location) where no entries
exist in the BranchSend table that have not been confirmed. There is a
trigger on these tables that then deletes records from BranchSend where
Sendtable and PkRef(s) match.
These SQLs are runin one app that can only have one copy active at a
time. However another app runs (multiple copies) that marks
SendTable.TransferConfimed to 'T'.
Question.
If the DELETE sql is running (in a read / write transaction) and another
write transaction changes SendTable.TransferConfimed to 'T' will that
cause a lock conflict? My guess is yes.
If so do you have any suggestions on how to do it without the lock conflict?
Thanks
Rob