pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Richard Huxton <dev@archonet.com>
Cc: lnd@hnit.is
Cc: pgsql-performance@postgresql.org
Subject: Re: Explain plan for 2 column index
Date: Thu, 29 Jan 2004 17:07:33 -0500
Message-ID: <28616.1075414053@sss.pgh.pa.us> (raw)
In-Reply-To: <200401292137.16750.dev@archonet.com>
References: <0A5B2E3C3A64CA4AB14F76DBCA76DDA44EF9B4@seifur.hnit.is>
	<200401292137.16750.dev@archonet.com>

Richard Huxton <dev@archonet.com> writes:
>> Index Scan using testtab_name_date_from on testtab  (cost=0.00..2.01
>> rows=1 width=18)
>> Index Cond: ((name)::text = 'name1'::text)
>> Filter: ((date_from)::timestamp with time zone =
>> ('now'::text)::timestamp(6)with time zone)

> What types are the columns here? If date_from isn't timestamp with time zone,
> that might be the issue.

It clearly isn't, since we can see a coercion to timestamp with time
zone in the query.  My guess is that the original SQL was
	WHERE ... date_from = current_timestamp
This should be
	WHERE ... date_from = localtimestamp
if timestamp without tz is the intended column datatype.  Of course,
it might just be that date_from was declared as the wrong type (it
really sucks that SQL specifies "timestamp" to default to "without
time zone" ...)

			regards, tom lane



view thread (3+ messages)

Message-ID: <28616.1075414053@sss.pgh.pa.us>
Permalink:  ../28616.1075414053@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/28616.1075414053@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-performance@postgresql.org
  Cc: tgl@sss.pgh.pa.us, dev@archonet.com, lnd@hnit.is
  Subject: Re: Explain plan for 2 column index
  In-Reply-To: <28616.1075414053@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