| From: | "Richard Broersma" <richard(dot)broersma(at)gmail(dot)com> | 
|---|---|
| To: | PFC <lists(at)peufeu(dot)com> | 
| Cc: | "Luigi N(dot) Puleio" <npuleio(at)rocketmail(dot)com>, "Craig Ringer" <craig(at)postnewspapers(dot)com(dot)au>, pgsql-performance(at)postgresql(dot)org | 
| Subject: | Re: EXPLAIN detail | 
| Date: | 2008-04-09 22:17:38 | 
| Message-ID: | 396486430804091517s1b99843cs10e812c0722f191b@mail.gmail.com | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-performance | 
On Wed, Apr 9, 2008 at 11:41 AM, PFC <lists(at)peufeu(dot)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.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | PFC | 2008-04-09 22:31:00 | Re: large tables and simple "= constant" queries using indexes | 
| Previous Message | Jeremy Harris | 2008-04-09 22:07:50 | Re: large tables and simple "= constant" queries using indexes |