Subject | Re: [firebird-support] Perfomance problems |
---|---|
Author | Carsten Schäfer |
Post date | 2004-12-01T17:17:53Z |
"Arno Brinkman" wrote:
Is there a rule when to take a union and when to take an or-clause ?
Has somebody ever made a real world application where the end-user can
self-construct the queries ?
My examples were very easy.
In reality the users sometimes make much more complicated queries and it
seems impossible for me to build optimal queries so that Firebird uses the
optimal plan.
mfg
Carsten
> Hi Carsten,The union works as fast as expected.
>
>
> In this case you want a UNION ALL instead of building a new query.
>
> SELECT
> t_apos.ID_APOS
> FROM
> t_apos
> JOIN t_auftrag ON t_apos.f_id_auftrag = t_auftrag.id_auftrag
> WHERE
> t_apos.f_id_werkstoff = 10
> UNION ALL
> SELECT
> t_apos.ID_APOS
> FROM
> t_apos
> JOIN t_auftrag ON t_apos.f_id_auftrag = t_auftrag.id_auftrag
> WHERE
> (t_auftrag.f_adatum between '31.10.2004 00:00' AND '02.12.2004
> 11:23')
>
Is there a rule when to take a union and when to take an or-clause ?
Has somebody ever made a real world application where the end-user can
self-construct the queries ?
My examples were very easy.
In reality the users sometimes make much more complicated queries and it
seems impossible for me to build optimal queries so that Firebird uses the
optimal plan.
mfg
Carsten