Subject | Re: [firebird-support] What is more effective execute block or select? |
---|---|
Author | Mark Rotteveel |
Post date | 2016-01-28T12:31:33Z |
On Wed, 27 Jan 2016 23:01:50 +0100, "setysvar setysvar@...
[firebird-support]" <firebird-support@yahoogroups.com> wrote:
Mark
[firebird-support]" <firebird-support@yahoogroups.com> wrote:
> [..] On the other hand, there are casesOut of curiosity: have you also compared this with using MERGE?
> where EXECUTE BLOCK can help performance (note, I speak for 2.5, I know
> nothing about Firebird 3):
>
> UPDATE <HugeTable> h
> SET <AField> = (SELECT <AnotherField> FROM <TinyTable> t WHERE
> h.<SelectiveIndexedField> = t.<SomeField>)
>
> is much slower than
>
> EXECUTE BLOCK AS
> Declare variable a integer;
> Declare variable b integer;
> BEGIN
> FOR SELECT DISTINCT <SomeField>, <AnotherField>
> FROM <TinyTable>
> INTO :a, :b do
> UPDATE HugeTable
> SET <AField> = :b
> WHERE <SelectiveIndexedField> = :a;
> END
Mark