X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 26C64D1B342 for ; Mon, 26 Jul 2004 18:40:10 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 35445-07 for ; Mon, 26 Jul 2004 21:40:08 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 8143FD1B257 for ; Mon, 26 Jul 2004 18:40:05 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.11/8.12.11) with ESMTP id i6QLe754010062; Mon, 26 Jul 2004 17:40:07 -0400 (EDT) To: Litao Wu Cc: "Matthew T. O'Connor" , "Harmon S. Nine" , pgsql-performance@postgresql.org Subject: Re: Timestamp-based indexing In-reply-to: <20040726212636.5563.qmail@web13125.mail.yahoo.com> References: <20040726212636.5563.qmail@web13125.mail.yahoo.com> Comments: In-reply-to Litao Wu message dated "Mon, 26 Jul 2004 14:26:36 -0700" Date: Mon, 26 Jul 2004 17:40:07 -0400 Message-ID: <10061.1090878007@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200407/185 X-Sequence-Number: 7576 Litao Wu writes: > How about changing: > CURRENT_TIMESTAMP - INTERVAL '10 minutes' > to > 'now'::timestamptz - INTERVAL '10 minutes' > It seems to me that Postgres will treat it as > a constant. Yeah, that works too, though again it might burn you if used inside a function or prepared statement. What you're doing here is to push the freezing of the "now" value even further upstream, namely to initial parsing of the command. regards, tom lane