Re: Grabbing Newest Records From Duplicates
От | Travis Whitton |
---|---|
Тема | Re: Grabbing Newest Records From Duplicates |
Дата | |
Msg-id | cf9b4f3e0703160855q537eafe6yf3c3bbea090e5b6e@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: Grabbing Newest Records From Duplicates (Tom Lane <tgl@sss.pgh.pa.us>) |
Ответы |
Re: Grabbing Newest Records From Duplicates
|
Список | pgsql-sql |
One last question, using the "weather report" example, is it going to improve performance for the DISTINCT ON query to add an index to the location and time columns?
Thanks a lot,
Travis
Thanks a lot,
Travis
On 3/16/07, Tom Lane <tgl@sss.pgh.pa.us> wrote:
"Travis Whitton" <tinymountain@gmail.com> writes:
> Given the following test table, I want to grab only the newest record and
> disregard any older duplicates based on name. Is this the most efficient way
> to do it?
No, it's gonna be pretty awful. The best way I know of involves
DISTINCT ON (see the "weather reports" example in the SELECT reference
page). Unfortunately that's a Postgres-only construct. If you want
something portable then you'll need something messy with subqueries...
regards, tom lane
В списке pgsql-sql по дате отправления: