Re: date index problems

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>
Cc: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>, Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: date index problems
Date: 2003-03-21 05:46:29
Message-ID: 10218.1048225589@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Gavin Sherry <swm(at)linuxworld(dot)com(dot)au> writes:
> I presume the type of plan_next is 'date'. Does casting '2003-01-01'::date
> - interval '1 week' to date help?

Easier would be
'2003-01-01'::date - 7
which yields a date to start with. But yeah, date minus interval yields
a timestamp, which will not automatically downconvert to a date, thus
you don't get to use an index on date.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Christopher Kings-Lynne 2003-03-21 05:50:56 Re: probs with postgres
Previous Message Tom Lane 2003-03-21 05:21:08 Re: probs with postgres