Re: Problem with phone list. - Mailing list pgsql-sql

From Fernando Hevia
Subject Re: Problem with phone list.
Date
Msg-id 022401c7e00d$379dbeb0$8f01010a@iptel.com.ar
Whole thread Raw
In response to Re: Problem with phone list.  (Michael Glaesemann <grzm@seespotcode.net>)
List pgsql-sql
--- Michael Glaesemann wrote:

> SELECT DISTINCT ON (phone_number)
>      phone_number, call_duration, id
> FROM calls
> ORDER BY phone_number
>      , call_duration DESC;

Wasn't acquainted with "DISTINCT ON (column)". 
I found it to be many times faster than other suggestions using JOIN.

Cheers,
Fernando.





pgsql-sql by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: Starting autovacuum in postgresql-8.1.9
Next
From: Joshua_Kramer
Date:
Subject: SUPERUSER vs CREATEUSER causes foul 'code smell'