Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id AE11C476356 for ; Thu, 30 Jan 2003 11:51:29 -0500 (EST) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id 04C2C476342 for ; Thu, 30 Jan 2003 11:51:29 -0500 (EST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.6/8.12.6) with ESMTP id h0UGpP5u020101; Thu, 30 Jan 2003 11:51:25 -0500 (EST) To: Pavel Hlavnicka Cc: pgsql-sql@postgresql.org Subject: Re: calculated expressions and index use In-reply-to: <3E394AA6.8080400@gingerall.cz> References: <3E394AA6.8080400@gingerall.cz> Comments: In-reply-to Pavel Hlavnicka message dated "Thu, 30 Jan 2003 16:54:14 +0100" Date: Thu, 30 Jan 2003 11:51:25 -0500 Message-ID: <20100.1043945485@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200301/508 X-Sequence-Number: 11373 Pavel Hlavnicka 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