Subject Re: [ib-support] Advice
Author Martijn Tonies
Hi,


>>> try this
>>>
>>> select Date_Birth
>>> from tableA
>>> where (extract (month from Date_Birth) between 4 and 5) and
>>> (extract (day from Date_Birth) between 10 and 12)
>>>
>>It will be very slow in a big table and this is my case.
>
>It won't cost you much to add Birth_Month and Birth_DOW smallint columns to
your table, and populate them with triggers using extract>() on the incoming
new.Date_birth. You can index both columns and search them very fast,
either together or separately.

My guess is that a compound index should be better - the selectivity of
1..12 and 1..31 is not exactly (very) high if you index them separately,
right?

Martijn Tonies
InterBase Workbench - the developer tool for InterBase and Firebird
http://www.interbaseworkbench.com

Upscene Productions
http://www.upscene.com

"This is an object-oriented system.
If we change anything, the users object."