Subject Re: [firebird-support] Re: Optimizing in (...) Statements
Author Arno Brinkman
Hi,

Change :

> where
> vp_parentpos = :PARENT and
> vp_delete != "T" and
> vp_posart = 1 and
> vo_delete != "T" and
> vo_status in ("2", "4", "9") and
> vo_art in (2, 3)

to :

where
vp_parentpos = :PARENT and
vp_delete != "T" and
vp_posart = 1 and
vo_delete != "T" and
((vo_status = "2" and vo_art = 2) or
(vo_status = "4" and vo_art = 2) or
(vo_status = "9" and vo_art = 2) or
(vo_status = "2" and vo_art = 3) or
(vo_status = "4" and vo_art = 3) or
(vo_status = "9" and vo_art = 3))

Why?

Because now it can use optimal the index on VO_ART, VO_STATUS
Let us know if this helps.

Regards,
Arno Brinkman
ABVisie

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Firebird open source database (based on IB-OE) with many SQL-99 features :
http://www.firebirdsql.org
http://www.firebirdsql.info
http://www.fingerbird.de/
http://www.comunidade-firebird.org/

Support list for Interbase and Firebird users :
firebird-support@yahoogroups.com

Nederlandse firebird nieuwsgroep :
news://newsgroups.firebirdsql.info