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

Поиск
Список
Период
Сортировка
Искать
От
Kevin Grittner
Тема
Re: Best way to get the latest revision from a table
Дата
Msg-id
4D3088E70200002500039632@gw.wicourts.gov
Ответ на
Список
Дерево обсуждения
Best way to get the latest revision from a table Nikolas Everett <nik9000@gmail.com>
Re: Best way to get the latest revision from a table "Kevin Grittner" <Kevin.Grittner@wicourts.gov>
Re: Best way to get the latest revision from a table Nikolas Everett <nik9000@gmail.com>
Re: Best way to get the latest revision from a table "Kevin Grittner" <Kevin.Grittner@wicourts.gov>
Re: Best way to get the latest revision from a table Shaun Thomas <sthomas@peak6.com>
Re: Best way to get the latest revision from a table "Kevin Grittner" <Kevin.Grittner@wicourts.gov>
Re: Best way to get the latest revision from a table Tom Lane <tgl@sss.pgh.pa.us>
Re: Best way to get the latest revision from a table "Kevin Grittner" <Kevin.Grittner@wicourts.gov>
Re: Best way to get the latest revision from a table Nikolas Everett <nik9000@gmail.com>
Re: Best way to get the latest revision from a table Robert Haas <robertmhaas@gmail.com>
Re: Best way to get the latest revision from a table Nikolas Everett <nik9000@gmail.com>
Re: Best way to get the latest revision from a table Shaun Thomas <sthomas@peak6.com>
Re: Best way to get the latest revision from a table Shaun Thomas <sthomas@peak6.com>
Shaun Thomas  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
В списке pgsql-performance по дате отправления
От: Shaun Thomas
Дата:
От: Tom Lane
Дата:
FAQ