Robert Haas <robertmh...@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

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

Reply via email to