pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Richard Broersma <richard.broersma@gmail.com>
To: PFC <lists@peufeu.com>
Cc: Luigi N. Puleio <npuleio@rocketmail.com>
Cc: Craig Ringer <craig@postnewspapers.com.au>
Cc: pgsql-performance@postgresql.org
Subject: Re: EXPLAIN detail
Date: Wed, 9 Apr 2008 15:17:38 -0700
Message-ID: <396486430804091517s1b99843cs10e812c0722f191b@mail.gmail.com> (raw)
In-Reply-To: <op.t9cwvfgecigqcu@apollo13.peufeu.com>
References: <981759.47577.qm@web33504.mail.mud.yahoo.com>
	<op.t9cwvfgecigqcu@apollo13.peufeu.com>

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.



view thread (12+ messages)

Message-ID: <396486430804091517s1b99843cs10e812c0722f191b@mail.gmail.com>
Permalink:  ../396486430804091517s1b99843cs10e812c0722f191b@mail.gmail.com/
Also on:    postgresql.org/message-id/396486430804091517s1b99843cs10e812c0722f191b@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-performance@postgresql.org
  Cc: richard.broersma@gmail.com, lists@peufeu.com, npuleio@rocketmail.com, craig@postnewspapers.com.au
  Subject: Re: EXPLAIN detail
  In-Reply-To: <396486430804091517s1b99843cs10e812c0722f191b@mail.gmail.com>
  References: <981759.47577.qm@web33504.mail.mud.yahoo.com> <op.t9cwvfgecigqcu@apollo13.peufeu.com> <396486430804091517s1b99843cs10e812c0722f191b@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox