pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: cgg007@yahoo.com
Cc: pgsql-sql@postgresql.org
Subject: Re: Query planner: current_* vs. explicit date
Date: Mon, 27 Oct 2003 11:05:34 -0500
Message-ID: <29706.1067270734@sss.pgh.pa.us> (raw)
In-Reply-To: <20031023152944.56378.qmail@web13805.mail.yahoo.com>
References: <20031023152944.56378.qmail@web13805.mail.yahoo.com>

Chris Gamache <cgg007@yahoo.com> 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



view thread (6+ messages)

Message-ID: <29706.1067270734@sss.pgh.pa.us>
Permalink:  ../29706.1067270734@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/29706.1067270734@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, cgg007@yahoo.com
  Subject: Re: Query planner: current_* vs. explicit date
  In-Reply-To: <29706.1067270734@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