Subject Re: [IB-Architect] Query Optimiser
Author Jason Wharton
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.

FWIW,
Jason Wharton
CPS - Mesa AZ
http://www.ibobjects.com


----- Original Message -----
From: <paulhope@...>
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