Subject | Re: [firebird-support] Performance question (repost) |
---|---|
Author | Dimitry Sibiryakov |
Post date | 2003-06-23T05:26:50Z |
On 22 Jun 2003 at 13:54, Paul Vinkenoog wrote:
InsertOrUpdate is this (by Dmitri Popov):
K=NULL;
FOR SELECT ...... INTO :K AS CURSOR TMP DO
UPDATE ..... WHERE CURRENT OF TMP;
IF (K IS NULL) THEN
INSERT INTO ....
Of course, column for selecting must be not nullable.
You can find the article on www.ibase.ru
SY, Dimitry Sibiryakov.
>C: write an SP InsertOrUpdate taking all the necessary parameters.According to tests by Alex Cherednichenko the fastest way to do
>Have
> the SP do an EXISTS test and act upon that. This way, you keep the
> testing on the server side, the data go only over the wire once.
>
>Which one is quickest depends on lots of factors, though.
InsertOrUpdate is this (by Dmitri Popov):
K=NULL;
FOR SELECT ...... INTO :K AS CURSOR TMP DO
UPDATE ..... WHERE CURRENT OF TMP;
IF (K IS NULL) THEN
INSERT INTO ....
Of course, column for selecting must be not nullable.
You can find the article on www.ibase.ru
SY, Dimitry Sibiryakov.