Re: Timestamp-based indexing

From: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Litao Wu <litaowu(at)yahoo(dot)com>, "Matthew T(dot) O'Connor" <matthew(at)zeut(dot)net>, "Harmon S(dot) Nine" <hnine(at)netarx(dot)com>, pgsql-performance(at)postgresql(dot)org
Subject: Re: Timestamp-based indexing
Date: 2004-07-27 01:53:01
Message-ID: 4105B57D.3040003@familyhealth.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

>>It seems to me that Postgres will treat it as
>>a constant.
>
>
> Yeah, that works too, though again it might burn you if used inside a
> function or prepared statement. What you're doing here is to push the
> freezing of the "now" value even further upstream, namely to initial
> parsing of the command.

What I do in my apps to get postgres to use the timestamp indexes in
some situations is to just generate the current timestamp in iso format
and then just insert it into the query as a constant, for that run of
the query.

Chris

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Greg Stark 2004-07-27 04:32:37 Re: arrays and indexes
Previous Message Tom Lane 2004-07-26 21:40:07 Re: Timestamp-based indexing