Subject Re: Optimizing a query
Author josef_gschwendtner
--- In firebird-support@yahoogroups.com, Svein Erling Tysvaer
<svein.erling.tysvaer@...> wrote:
>
> A better way (performance wise) could be:
>
> if (ZU is null) then
> begin
> for
> select KA, sum(ValNet)
> from BU
> where KG = :KeyValue
> group by KA
> into :KA, :SumNet
> do
> suspend;
> end
> else
> begin
> for
> select KA, sum(ValNet)
> from BU
> where KG = :KeyValue and Zu = :ZU
> group by KA
> into :KA, :SumNet
> do
> suspend;
> end;
>
Thank you for your reply.
That is exactly what we did in the past.
Problem is that we have two such nullable parameters and end up with
4 queries. So we try to make code more clear (but perfomance should
be the same).

Regards,
Josef