Re: [HACKERS] count function alternative in postgres

2010-04-05 Thread Pavel Stehule
2010/4/5 Kevin Grittner : > Robert Haas 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 B

Re: [HACKERS] count function alternative in postgres

2010-04-05 Thread Kevin Grittner
Robert Haas 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

Re: [HACKERS] count function alternative in postgres

2010-04-05 Thread Robert Haas
On Sat, Apr 3, 2010 at 8:59 AM, junaidmalik14 wrote: > > Is there any alternative of mysql function COUNT(DISTINCT expr,[expr...]) in > postgres. We get error if we > > write count like this count(distinct profile.id, profile.name, profile.age) > but it works well in mysql. > > Reference url is gi

Re: [HACKERS] count function alternative in postgres

2010-04-05 Thread Kevin Grittner
junaidmalik14 wrote: > Is there any alternative of mysql function COUNT(DISTINCT > expr,[expr...]) in postgres. We get error if we write count like > this count(distinct profile.id, profile.name, profile.age) Is that semantically different from this SQL standard syntax?: SELECT profile.id, p

[HACKERS] count function alternative in postgres

2010-04-05 Thread junaidmalik14
Is there any alternative of mysql function COUNT(DISTINCT expr,[expr...]) in postgres. We get error if we write count like this count(distinct profile.id, profile.name, profile.age) but it works well in mysql. Reference url is given below http://dev.mysql.com/doc/refman/5.1/en/group-by-functi