Re: count function alternative in postgres

Поиск
Список
Период
Сортировка
От Kevin Grittner
Тема Re: count function alternative in postgres
Дата
Msg-id 4BB9C9B00200002500030463@gw.wicourts.gov
обсуждение исходный текст
Ответ на Re: count function alternative in postgres  (Robert Haas <robertmhaas@gmail.com>)
Ответы Re: count function alternative in postgres
Список pgsql-hackers
Robert Haas <robertmhaas@gmail.com> wrote:
> You can do:
> 
> SELECT COUNT(*) FROM (SELECT DISTINCT profile.id, profile.name,
> profile.age FROM ...) x;
Ah, I see what they wanted now.  In older versions of PostgreSQL,
they might get better performance in some cases by using GROUP BY:
SELECT COUNT(*) FROM (SELECT id, name, age FROM profile GROUP BY id, name, age) x;
I don't remember offhand what version started considering a hash for
DISTINCT.
-Kevin


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

Предыдущее
От: Jaime Casanova
Дата:
Сообщение: Re: Autonomous transaction
Следующее
От: Greg Sabino Mullane
Дата:
Сообщение: Show schema name on REINDEX DATABASE