Re: Index on timestamp field, and now()

From: Denis Perchine <dyp(at)perchine(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: lockhart(at)fourpalms(dot)org, pgsql-general(at)postgresql(dot)org
Subject: Re: Index on timestamp field, and now()
Date: 2002-02-12 15:38:50
Message-ID: 20020212121530.32F681FE84@mx.webmailstation.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tuesday 12 February 2002 21:34, Tom Lane wrote:
> Denis Perchine <dyp(at)perchine(dot)com> writes:
> > webmailstation=> explain select * from queue where send_date > timestamp
> > 'now';
> >
> > But I use a comparison with now() + '20 years'::interval, not with
> > now()...
>
> That's not the example you quoted. More to the point, if you write it
> that way then it isn't a constant, at least not in 7.2's limited
> understanding of what constant values are. You could work around that
> with a custom function marked isCachable; see the archives.

Oups. Sorry my mistake. But 7.2's limited understanding is enough to do
constant propagation as far as I can see. :-)))

webmailstation=> explain select * from queue where send_date > timestamp
'now' + '20 years'::interval;
NOTICE: QUERY PLAN:

Index Scan using queue_senddate_key on queue (cost=0.00..30.55 rows=8
width=192)

EXPLAIN

Thanks for the hint.

--
Denis

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2002-02-12 15:52:01 Re: Index on timestamp field, and now()
Previous Message Holger Marzen 2002-02-12 15:38:23 Re: index use again and again