Re: Timestamp-based indexing - Mailing list pgsql-performance

From Tom Lane
Subject Re: Timestamp-based indexing
Date
Msg-id 10061.1090878007@sss.pgh.pa.us
Whole thread Raw
In response to Re: Timestamp-based indexing  (Litao Wu <litaowu@yahoo.com>)
Responses Re: Timestamp-based indexing
List pgsql-performance
Litao Wu <litaowu@yahoo.com> writes:
> How about changing:

> CURRENT_TIMESTAMP - INTERVAL '10 minutes'
> to
> 'now'::timestamptz - INTERVAL '10 minutes'

> 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.

            regards, tom lane

pgsql-performance by date:

Previous
From: Litao Wu
Date:
Subject: Re: Timestamp-based indexing
Next
From: Christopher Kings-Lynne
Date:
Subject: Re: Timestamp-based indexing