Re: count function alternative in postgres - Mailing list pgsql-hackers

From Pavel Stehule
Subject Re: count function alternative in postgres
Date
Msg-id n2p162867791004051001sf0c4adb5t1ad954c03267b549@mail.gmail.com
Whole thread Raw
In response to Re: count function alternative in postgres  ("Kevin Grittner" <Kevin.Grittner@wicourts.gov>)
List pgsql-hackers
2010/4/5 Kevin Grittner <Kevin.Grittner@wicourts.gov>:
> 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.
>
8.4

http://www.postgresql.org/docs/8.4/static/release-8-4.html

regards
Pavel

> -Kevin
>
> --
> Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers
>


pgsql-hackers by date:

Previous
From: Greg Sabino Mullane
Date:
Subject: Show schema name on REINDEX DATABASE
Next
From: Simon Riggs
Date:
Subject: Re: Re: [COMMITTERS] pgsql: Check compulsory parameters in recovery.conf in standby_mode, per