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

From Florian Weimer
Subject Re: Picking out the most recent row using a time stamp column
Date
Msg-id 87r5auwm79.fsf@mid.deneb.enyo.de
Whole thread Raw
In response to Re: Picking out the most recent row using a time stamp column  ("Kevin Grittner" <Kevin.Grittner@wicourts.gov>)
List pgsql-performance
* Kevin Grittner:

> Dave Crooke <dcrooke@gmail.com> wrote:
>
>> create table data
>>    (id_key int,
>>     time_stamp timestamp without time zone,
>>     value double precision);
>>
>> create unique index data_idx on data (id_key, time_stamp);
>
>> I need to find the most recent value for each distinct value of
>> id_key.
>
> 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, just
as it doesn't keep track of the character encoding of TEXT columns.
Unless suppressed with WITHOUT TIME ZONE, PostgreSQL makes up some
time zone on demand.  This makes TIMESTAMP WITH TIME ZONE not that
useful, and it's often to use TIMESTAMP WITHOUT TIME ZONE with times
in UTC.

pgsql-performance by date:

Previous
From: Dave Johansen
Date:
Subject: Re: Picking out the most recent row using a time stamp column
Next
From: "Kevin Grittner"
Date:
Subject: Re: Picking out the most recent row using a time stamp column