Subject | Deadlock @ Update |
---|---|
Author | Matthias Hanft |
Post date | 2006-04-22T12:52:54Z |
Hello,
I have a FB database where one record (always the same)
is updated very often (currently once per minute for
testing purposes; later perhaps once an hour). The SQL
command goes like this:
update UPDATES
set DATETIME=:DATETIME, FILENAME=:FILENAME,
DATE_FROM=:DATE_FROM, DATE_TO=:DATE_TO
where ID=:ID;
(This is surrounded by StartTransaction and Commit.)
In 99,973% :-) this command succeeds. The rest raises
an exception "deadlock update conflicts with concurrent
update".
Since there are 2 processes which perform this update,
I suppose that this error occurs when both processes
try to execute the update simultaneously.
Is there any possibility to avoid this error? It would
be sufficient if the "latest update wins".
I'm using Delphi IBX with the default settings concerning
transactions and all that. I'm not even quite sure if the
error occurs at "ExecQuery" or "Commit", but according to
program flow (try/except etc.), it should already occur
at "ExecQuery".
Best regards
Matthias
I have a FB database where one record (always the same)
is updated very often (currently once per minute for
testing purposes; later perhaps once an hour). The SQL
command goes like this:
update UPDATES
set DATETIME=:DATETIME, FILENAME=:FILENAME,
DATE_FROM=:DATE_FROM, DATE_TO=:DATE_TO
where ID=:ID;
(This is surrounded by StartTransaction and Commit.)
In 99,973% :-) this command succeeds. The rest raises
an exception "deadlock update conflicts with concurrent
update".
Since there are 2 processes which perform this update,
I suppose that this error occurs when both processes
try to execute the update simultaneously.
Is there any possibility to avoid this error? It would
be sufficient if the "latest update wins".
I'm using Delphi IBX with the default settings concerning
transactions and all that. I'm not even quite sure if the
error occurs at "ExecQuery" or "Commit", but according to
program flow (try/except etc.), it should already occur
at "ExecQuery".
Best regards
Matthias