Re: Picking out the most recent row using a time stamp column

From: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
To: <fw(at)deneb(dot)enyo(dot)de>
Cc: <dcrooke(at)gmail(dot)com>,<pgsql-performance(at)postgresql(dot)org>
Subject: Re: Picking out the most recent row using a time stamp column
Date: 2011-02-26 21:52:44
Message-ID: 4D6921CC020000250003B083@gw.wicourts.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Florian Weimer wrote:
> Kevin Grittner:

>> Well, unless you use timestamp WITH time zone, you might not be
>> able to do that at all. There are very few places where timestamp
>> WITHOUT time zone actually makes sense.
>
> I don't think PostgreSQL keeps track of actual time zone values,

True -- TIMESTAMP WITH TIME ZONE is always stored in UTC, which makes
it part of a consistent time stream. If you use TIMESTAMP WITHOUT
TIME ZONE, then unless you go to a lot of trouble you have a gap in
your time line in the spring and an overlap in autumn. With enough
work you can dance around that, but it's a heck of lot easier when
you can count on the UTC storage.

It sounds like you've successfully managed to find a way to dance
around it, so it might not be worth trying to refactor now; but I'd
bet your code would be simpler and more robust if you worked with the
data type intended to represent a moment in the stream of time
instead of constantly trying to pin the WITHOUT TIME ZONE to a time
zone (UTC) explicitly.

-Kevin

Browse pgsql-performance by date

  From Date Subject
Next Message Robert Haas 2011-02-27 17:59:28 Re: Talking about optimizer, my long dream
Previous Message Dave Johansen 2011-02-26 21:38:05 Re: Picking out the most recent row using a time stamp column