Re: Best way to get the latest revision from a table

From: Nikolas Everett <nik9000(at)gmail(dot)com>
To: Kevin Grittner <Kevin(dot)Grittner(at)wicourts(dot)gov>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Best way to get the latest revision from a table
Date: 2011-01-14 22:40:08
Message-ID: AANLkTi=B4yeenOdV3i3zpq_+hUpCidBS=vLi7ZRmYjhy@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Fri, Jan 14, 2011 at 5:30 PM, Kevin Grittner <Kevin(dot)Grittner(at)wicourts(dot)gov
> wrote:

> SELECT y.*
> from (select a, max(revision) as revision
> from test where a between 2 and 200
> group by a) x
> join test y using (a, revision);

While certainly simpler than my temp table this really just exposes a flaw
in my example - I'm really going to be doing this with an arbitrary list of
As.

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Marti Raudsepp 2011-01-14 22:42:43 Re: "COPY TO stdout" statements occurrence in log files
Previous Message Kevin Grittner 2011-01-14 22:30:49 Re: Best way to get the latest revision from a table