Re: calculated expressions and index use

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Pavel Hlavnicka <pavel(at)gingerall(dot)cz>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: calculated expressions and index use
Date: 2003-01-30 16:51:25
Message-ID: 20100.1043945485@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Pavel Hlavnicka <pavel(at)gingerall(dot)cz> writes:
> select * from foo
> where created_at >= 'now'::timestamp - '1 hour'::interval;

> My table is indexed on created_at field. The query above doesn't use it,

What's your PG version? In 7.2 and later that expression will be folded
to a constant.

regards, tom lane

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message --CELKO-- 2003-01-30 19:13:39 Re: double linked list
Previous Message Arjen van der Meijden 2003-01-30 16:13:40 Re: calculated expressions and index use