Re: Explain plan for 2 column index : timestamps and time zones

From: <lnd(at)hnit(dot)is>
To: <pgsql-performance(at)postgresql(dot)org>
Cc: <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: Explain plan for 2 column index : timestamps and time zones
Date: 2004-01-30 08:47:51
Message-ID: 0A5B2E3C3A64CA4AB14F76DBCA76DDA44EF9B5@seifur.hnit.is
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance


> From: Tom Lane [mailto:tgl(at)sss(dot)pgh(dot)pa(dot)us]

> 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.

Thank you. The problem was exactly this:

current_timestamp: TIMESTAMP with TZ

my attribute "date_from TIMESTAMP " - without TZ

After change to

WHERE ... date_from = localtimestamp

the plan worked just well.

> (it really sucks that SQL specifies "timestamp" to default to "without time
zone" ...)

Tzones is one area I never delt with and IMMEDIATELY ran into problem,
implicit type conversion is an evil.

Browse pgsql-performance by date

  From Date Subject
Next Message Alexandra Birch 2004-01-30 09:06:13 Re: limit 1 and functional indexes: SOLVED
Previous Message Kari Lavikka 2004-01-30 08:16:23 Cost of indexscan