X-Original-To: pgsql-sql@postgresql.org Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id C5A044762B6 for ; Fri, 31 Jan 2003 03:46:23 -0500 (EST) Received: from termit.gingerall.cz (termit.gingerall.cz [212.24.153.2]) by postgresql.org (Postfix) with ESMTP id 75BA1475E13 for ; Fri, 31 Jan 2003 03:46:22 -0500 (EST) Received: from gingerall.cz (IDENT:0ZZXf8y2G1rAr9yGuzA3PxckO+NZtjmG@angrest.gingerall.cz [212.24.153.10]) by termit.gingerall.cz (8.11.2/8.11.6) with ESMTP id h0V8i7A31633; Fri, 31 Jan 2003 09:44:07 +0100 Message-ID: <3E3A3757.3040906@gingerall.cz> Date: Fri, 31 Jan 2003 09:44:07 +0100 From: Pavel Hlavnicka User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2) Gecko/20021203 X-Accept-Language: en, cs MIME-Version: 1.0 To: Tom Lane Cc: pgsql-sql@postgresql.org Subject: Re: calculated expressions and index use References: <3E394AA6.8080400@gingerall.cz> <20100.1043945485@sss.pgh.pa.us> In-Reply-To: <20100.1043945485@sss.pgh.pa.us> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200301/519 X-Sequence-Number: 11384 I use 7.2.1. :( Do you thing my considerations on constant vs. expression are correct? I tried different syntax, no success. Thanks Pavel Tom Lane wrote: > 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 -- Pavel Hlavnicka Ginger Alliance www.gingerall.com