Subject | Re: Performance question (repost) |
---|---|
Author | Didier Gasser-Morlay |
Post date | 2003-06-23T08:35:09Z |
--- In firebird-support@yahoogroups.com, "Dimitry Sibiryakov"
<SD@t...> wrote:
<SD@t...> wrote:
> On 22 Jun 2003 at 13:54, Paul Vinkenoog wrote:Thanks, I'll give it a go.
>
> >C: write an SP InsertOrUpdate taking all the necessary parameters.
> >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.
>
> According to tests by Alex Cherednichenko the fastest way to do
> 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.