X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 183E0D1B52F for ; Mon, 27 Oct 2003 16:06:08 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 75536-02 for ; Mon, 27 Oct 2003 12:05:36 -0400 (AST) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id 8FD53D1B507 for ; Mon, 27 Oct 2003 12:05:35 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.10/8.12.10) with ESMTP id h9RG5Yit029707; Mon, 27 Oct 2003 11:05:34 -0500 (EST) To: cgg007@yahoo.com Cc: pgsql-sql@postgresql.org Subject: Re: Query planner: current_* vs. explicit date In-reply-to: <20031023152944.56378.qmail@web13805.mail.yahoo.com> References: <20031023152944.56378.qmail@web13805.mail.yahoo.com> Comments: In-reply-to Chris Gamache message dated "Thu, 23 Oct 2003 08:29:44 -0700" Date: Mon, 27 Oct 2003 11:05:34 -0500 Message-ID: <29706.1067270734@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200310/342 X-Sequence-Number: 15742 Chris Gamache writes: > By giving it a definitive range I was able to coax query planner to use the > index: > SELECT id FROM trans_table WHERE trans_date >= (SELECT > current_date::timestamptz) AND trans_date < (SELECT current_timestamp); > BTW, This didn't work: > SELECT id FROM trans_table WHERE trans_date >= current_date::timestamptz AND > trans_date < current_timestamp; [ scratches head... ] AFAICS the latter should "work" too. Doesn't EXPLAIN show the same estimated row count for both versions? regards, tom lane