From: Florian Weimer <fw@deneb.enyo.de>
To: Kevin Grittner <Kevin.Grittner@wicourts.gov>
Cc: Dave Crooke <dcrooke@gmail.com>
Cc: pgsql-performance <pgsql-performance@postgresql.org>
Subject: Re: Picking out the most recent row using a time stamp column
Date: Sat, 26 Feb 2011 21:54:50 +0100
Message-ID: <87r5auwm79.fsf@mid.deneb.enyo.de> (raw)
In-Reply-To: <4D6668CF020000250003AFC9@gw.wicourts.gov>
References: <AANLkTinTgU-jfPOhrfteBvhAhgG_8zknpk13N9L4QMap@mail.gmail.com>
<4D6668CF020000250003AFC9@gw.wicourts.gov>
* 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.
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: fw@deneb.enyo.de, Kevin.Grittner@wicourts.gov, dcrooke@gmail.com
Subject: Re: Picking out the most recent row using a time stamp column
In-Reply-To: <87r5auwm79.fsf@mid.deneb.enyo.de>
* 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