Subject Re: [firebird-support] Re: select birthdays form the next several days
Author Arno Brinkman
Hi,

> where bdate between bdateblahblah and bdateblahblah
>
> it is not uses the index on bdate.
>
> but
> when i use:
> ...
> where bdate>'01.01.1900' and
> bdate between bdateblahblah and bdateblahblah
>
> then it uses the index on bdate (Query PLAN reports)
>
> is this correct behaviour?

Yes, an index will be used to build a bitmap for dates where > '01.01.1900'.

> adding and extra condition helps to use index?

Because the condition is a constant and no expression with an other field from the same table.

> or there is a plan report problem ( natural+index scan? )

No, the "bdate between bdateblahblah and bdateblahblah" filter will be handled after internally the
records are fetched from disk.

Regards,
Arno Brinkman
ABVisie

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
General database developer support:
http://www.databasedevelopmentforum.com

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

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

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