On Wed, Apr 9, 2008 at 11:41 AM, PFC <lists@peufeu.com> wrote:
> In order to use the index, you could rewrite it as something like :
> a.calldate >= '2008-04-09' AND a.calldate < ('2008-04-09'::DATE + '1
> DAY'::INTERVAL)
> This is a RANGE query (just like BETWEEN) which is index-friendly.
Another option would be to create a functional index on date_trunc(
'day', cdr.calldate)
then using a where condition like:
date_trunc(a.calldate) = '2008-04-09'
would definitely use an index.
--
Regards,
Richard Broersma Jr.