From: Tom Lane <tgl@sss.pgh.pa.us>
To: Richard Huxton <dev@archonet.com>
Cc: Reiner Dassing <dassing@wettzell.ifag.de>
Cc: pgsql-performance@postgresql.org
Subject: Re: Select on timestamp-day slower than timestamp alone
Date: Tue, 06 May 2003 09:59:08 -0400
Message-ID: <24863.1052229548@sss.pgh.pa.us> (raw)
In-Reply-To: <200305061404.24194.dev@archonet.com>
References: <3EB75D5F.5080406@wettzell.ifag.de>
<200305061404.24194.dev@archonet.com>
Richard Huxton <dev@archonet.com> writes:
> Well, the "why" is because the number of rows recommended is so big
> (rows=10253528) - I'm also puzzled why we get "timestamp without time zone".
Because that's what he specified the constant to be.
> Does an explicit cast to "with time zone" help?
Writing the constant as timestamp with time zone would fix it.
Casting after-the-fact would not.
The reason: although both "timestamp minus interval" and "timestamptz
minus interval" are constant-foldable, timestamp-to-timestamptz
conversion is not (because it depends on SET TIMEZONE). So the
planner has to fall back to a default selectivity estimate. With real
constants it is able to derive a better estimate.
regards, tom lane
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-performance@postgresql.org
Cc: tgl@sss.pgh.pa.us, dev@archonet.com, dassing@wettzell.ifag.de
Subject: Re: Select on timestamp-day slower than timestamp alone
In-Reply-To: <24863.1052229548@sss.pgh.pa.us>
References: <3EB75D5F.5080406@wettzell.ifag.de> <200305061404.24194.dev@archonet.com> <24863.1052229548@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