I have this simple select
select sum(apos.f_gewicht) as Gewicht
from t_apos apos
where COALESCE(apos.f_dat_anlieferung, apos.f_dat_erstellung) between 
'2013-01-15' and '2013-01-16'
which does an natural scan on table t_apos although an index is on both 
fields.

select sum(apos.f_gewicht) as Gewicht
from t_apos apos
where apos.f_dat_anlieferung between '2013-01-15' and '2013-01-16'

and

select sum(apos.f_gewicht) as Gewicht
from t_apos apos
where apos.f_dat_erstellung between '2013-01-15' and '2013-01-16'

both uses the index .
Why is the index not used when coalesce is used?
I use Firebird 2.5.2 64bit on Windows 7.

Carsten


------------------------------------

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Visit http://www.firebirdsql.org and click the Resources item
on the main (top) menu.  Try Knowledgebase and FAQ links !

Also search the knowledgebases at http://www.ibphoenix.com 

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/firebird-support/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/firebird-support/join
    (Yahoo! ID required)

<*> To change settings via email:
    firebird-support-dig...@yahoogroups.com 
    firebird-support-fullfeatu...@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
    firebird-support-unsubscr...@yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/

Reply via email to