Re: DISTINCT vs. GROUP BY

Поиск
Список
Период
Сортировка
От Greg Stark
Тема Re: DISTINCT vs. GROUP BY
Дата
Msg-id 87fys0ojrg.fsf@stark.xeocode.com
обсуждение исходный текст
Ответ на Re: DISTINCT vs. GROUP BY  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Tom Lane <tgl@sss.pgh.pa.us> writes:

> I do think hash aggregation is a plausible alternative implementation of
> plain DISTINCT, but I don't see the case for using it for DISTINCT ON.

It could be done without presorting the input though not with a simple
first()-like function. It would have be a sort of two-argument min() function
that kept a state variable for the smallest value found so far of the sort
key.

My main motivation here is that it's odd to have two code paths for
implementing the two language constructs when one is really just a special
case of the other. It's a source of cases like this where the code to
implement a query path exists but isn't accessible due to the way the query is
written.

-- 
greg



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

Предыдущее
От: Patrick Welche
Дата:
Сообщение: Re: postmaster core dump
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: Spinlocks, yet again: analysis and proposed patches