Re: Picking out the most recent row using a time stamp column - Mailing list pgsql-performance

From Kevin Grittner
Subject Re: Picking out the most recent row using a time stamp column
Date
Msg-id 4D6921CC020000250003B083@gw.wicourts.gov
Whole thread Raw
List 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

pgsql-performance by date:

Previous
From: Florian Weimer
Date:
Subject: Re: Picking out the most recent row using a time stamp column
Next
From: Robert Haas
Date:
Subject: Re: Talking about optimizer, my long dream