Subject | Re: [IBO] Re: Please. A solution with TRANSACTIONS for this problem |
---|---|
Author | TeamIBO |
Post date | 2002-02-01T22:43:17Z |
> Problems with the sweep interval????Make sure you are not committing with every insert - as in such cases
the sweep interval could be causing your problems (defaults to kick in
every 20000 transactions).
Ensure you are using an explicit transaction with AutoCommit set
to false.
Also, I see your procedure looks like...
> CREATE PROCEDURE INS_UPD (PID VARCHAR(6),Note that attempting an insert and then catching the failure may be
> PNAME VARCHAR(50))
> AS
> begin insert into test(id,name,numb) values ( :pId, :pName, 1);
> when sqlcode -803 do
> update test
> set numb=numb+1
> where id=:pId;
inappropriate in your situation. You may find you get better
performance by explicitly doing what you expect the above code to do
implicitly...
IF (EXISTS(SELECT ID FROM TEST WHERE ID=:pId)) THEN
<update>
ELSE
<insert>
I am not sure if this will make any difference or not, it depends on
the internals of the engine.
--
Geoff Worboys - TeamIBO
Telesis Computing