Subject Re: Superslowdown with an extra OR
Author maximshiryaev
Hi.

From my experience any query with OR operator can be converted to
union if FB optimizer has some difficolties.

I mean:

SELECT *
FROM t
WHERE a = :a OR b = :b

can be substitutd by:

SELECT *
FROM t
WHERE a = :a

UNION ALL

SELECT *
FROM t
WHERE b = :b

In most cases it forces FB to use indicies on a and b columns if any.
The only problem is your FIRST 1 clause. Is it actually neccessary?

Maxim.


--- In firebird-support@yahoogroups.com, Tim Gahnström
<tim.gahnstrom@...> wrote:
>
> Hi
>
> We are running an embedded Firebird on several hundred old PCs and
have just run into a strange slowdown that probably has very simple
explanation.
>
...