Subject Re: Query Optimiser
Author paulhope@allcomm.co.uk
Jason

> If you are in a stored procedure I suggest that you use an IF ( )
THEN and
> make two totally separate statements and get rid of the OR totally.
I think
> somehow the OR prevents use of the index.
>
> I would be curious to know why since I have battled this issue
before as
> well.
>
I havn't used IF THEN because there are too many selection option and
it would be a mess - the example was only one 'whereitem' of about
10! The technique seems to provide a very powerful way of preparing
data in response to a user input screen with many optional selection
criteria and where the data comes from multiple tables and can
benefit from server-side manipulation.

Regards
Paul

>
> ----- Original Message -----
> From: <paulhope@a...>
> To: <IB-Architect@egroups.com>
> Sent: Monday, January 15, 2001 6:43 AM
> Subject: [IB-Architect] Query Optimiser
>
>
> > I've discovered recently that a technique I use for getting the
> > inability to
> > create dynamic SQL in a stored procedure creates problems with
query
> > plans.
> > (Still using 5.6 but I assume the same applies in 6)
> >
> > If I have select . . from . . where invoice_number>=:INVNO -- the
> > plan uses
> > the index, but
> > select . . from . . where ((-1=:INVNO)or(invoice_number>=:INVNO))
> > doesn't
> > and the extraction is very slow.
> >
> > Is this a horrible thing to do or is an enhancement worth
suggesting?
> >
> > Regards
> > Paul