Re: EXPLAIN detail - Mailing list pgsql-performance

From Richard Broersma
Subject Re: EXPLAIN detail
Date
Msg-id 396486430804091517s1b99843cs10e812c0722f191b@mail.gmail.com
Whole thread Raw
In response to Re: EXPLAIN detail  (PFC <lists@peufeu.com>)
List pgsql-performance
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.

pgsql-performance by date:

Previous
From: Bill Moran
Date:
Subject: Re: large tables and simple "= constant" queries using indexes
Next
From: PFC
Date:
Subject: Re: large tables and simple "= constant" queries using indexes