Shaun Thomas <sthomas(at)peak6(dot)com> wrote:
> This actually looks like a perfect candidate for DISTINCT ON.
>
> SELECT DISTINCT ON (a, b) a, b, revision
> FROM test
> ORDER BY a, b DESC;
I wouldn't say perfect. It runs about eight times slower than what
I suggested and returns a fairly random value for revision instead
of the max(revision).
-Kevin