Subject Re: Firebird Plan Analyzer
Author kick_tisho
--- In firebird-support@yahoogroups.com, Svein Erling Tysvær
<svein.erling.tysvaer@k...> wrote:
> Hi Stanislav
>
> > 2. To write my own plan for such big queries (more of them with
10
> > filters and more) seems like an absurd
>
> This isn't possible, the query simply cannot use an index when you
use
> OR <something without an index>. If you want to use the index
where
> possible, you have to rewrite your procedure to something like
>
> IF (:P_IMPORTID IS NULL)
> BEGIN
> FOR
> SELECT
> C.ID
> FROM
> CONTACTS C
> DO
> SUSPEND;
> END
> ELSE
> BEGIN
> FOR
> SELECT
> C.ID
> FROM
> CONTACTS C
> WHERE (C.IMPORTID = :P_IMPORTID)
> DO
> SUSPEND;
> END
> END;
>
> HTH,
> Set


The problem with this is that i have 20 filter params per procedure.
and the select itself returns 40 params. It will be big code
duplication.