pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Pavel Hlavnicka <pavel@gingerall.cz>
Cc: pgsql-sql@postgresql.org
Subject: Re: calculated expressions and index use
Date: Thu, 30 Jan 2003 11:51:25 -0500
Message-ID: <20100.1043945485@sss.pgh.pa.us> (raw)
In-Reply-To: <3E394AA6.8080400@gingerall.cz>
References: <3E394AA6.8080400@gingerall.cz>

Pavel Hlavnicka <pavel@gingerall.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



view thread (6+ messages)  latest in thread

Message-ID: <20100.1043945485@sss.pgh.pa.us>
Permalink:  ../20100.1043945485@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/20100.1043945485@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, pavel@gingerall.cz
  Subject: Re: calculated expressions and index use
  In-Reply-To: <20100.1043945485@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox