performance comparison: DISTINCT and GROUP BY

Поиск
Список
Период
Сортировка
От Devrim GUNDUZ
Тема performance comparison: DISTINCT and GROUP BY
Дата
Msg-id Pine.LNX.4.44.0208191340200.4893-100000@oper.metu.edu.tr
обсуждение исходный текст
Список pgsql-sql
Hi,

We have two different queries:
SELECT name,surname  FROM my_table GROUP BY name;

and
SELECT DISTINCT on(name) name,surname  * FROM my_table;

which gives us the same result.

Do these queries differ by their performances? I mean, which one works 
faster? DISTINCT or GROUP BY?

Best regards.

-- 

Devrim GUNDUZ

devrim@oper.metu.edu.tr            Tel  : (312) 295 9318
devrim.gunduz@linux.org.tr        Faks : (312) 295 9494
    Web : http://devrim.oper.metu.edu.tr    -------------------------------------



В списке pgsql-sql по дате отправления:

Предыдущее
От: "Julian Scarfe"
Дата:
Сообщение: Re: Ordering with GROUPs
Следующее
От: "Christopher Kings-Lynne"
Дата:
Сообщение: Re: performance comparison: DISTINCT and GROUP BY