| From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
|---|---|
| To: | Kevin Grittner <Kevin(dot)Grittner(at)wicourts(dot)gov> |
| Cc: | junaidmalik14 <junaidmalik14(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org |
| Subject: | Re: count function alternative in postgres |
| Date: | 2010-04-05 17:01:10 |
| Message-ID: | n2p162867791004051001sf0c4adb5t1ad954c03267b549@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
2010/4/5 Kevin Grittner <Kevin(dot)Grittner(at)wicourts(dot)gov>:
> Robert Haas <robertmhaas(at)gmail(dot)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(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers
>
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Simon Riggs | 2010-04-05 18:29:46 | Re: Re: [COMMITTERS] pgsql: Check compulsory parameters in recovery.conf in standby_mode, per |
| Previous Message | Kevin Grittner | 2010-04-05 16:29:52 | Re: count function alternative in postgres |