Re: Efficient date range search?

From: Jean-Luc Lachance <jllachan(at)nsd(dot)ca>
To: Bruno Wolff III <bruno(at)wolff(dot)to>
Cc: Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl>, shridhar_daithankar(at)persistent(dot)co(dot)in, pgsql-general(at)postgresql(dot)org
Subject: Re: Efficient date range search?
Date: 2002-10-07 18:59:37
Message-ID: 3DA1D999.D355DB0C@nsd.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

DEFAULT 'infinity' is much better than my DEFAULT '9999-12-31', I
agree.

Bruno Wolff III wrote:
>
> On Mon, Oct 07, 2002 at 13:32:09 -0400,
> Jean-Luc Lachance <jllachan(at)nsd(dot)ca> wrote:
> > Alvaro Herrera wrote:
> > >
> > > On Mon, Oct 07, 2002 at 12:11:35PM -0400, Jean-Luc Lachance wrote:
> > > > Shridhar Daithankar wrote:
> > > > > Create an index on died field. And query like
> > > > >
> > > > > select * from pets where died < "last year july 4 7:01 PM;
> > >
> > > > If the pet is still alive today died would be NULL and the where clause
> > > > would not be true.
> > >
> > > In that case check for NULL explicitly,
> > >
> > > select * from pets where died > [date] or died is null;
> >
> >
> > Then you're back to whole table scan... :(
>
> You could use 'infinity'::timestamp as a code for pets that are currently
> alive instead of null.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Marie G. Tuite 2002-10-07 19:22:09 sloooow query
Previous Message Bruno Wolff III 2002-10-07 17:52:48 Re: Efficient date range search?