Re: What's wrong with this group by clause? - Mailing list pgsql-sql

From Manfred Koizar
Subject Re: What's wrong with this group by clause?
Date
Msg-id fhb37vsiacbvl4u9tqai03p806p28q3rej@4ax.com
Whole thread Raw
In response to Re: What's wrong with this group by clause?  ("Len Morgan" <len-morgan@crcom.net>)
List pgsql-sql
On Thu, 13 Mar 2003 01:34:34 -0600, "Len Morgan"
<len-morgan@crcom.net> wrote:
>>GROUP BY
> >  field1,
>  > field2,
>  >name;
>I think the problem is that you don't have a column to group on.

field1, field2, and name are the grouping columns.

>Try adding
>SELECT ....,count(*).... so that there is an aggregate of some kind.

You don't need an aggregate in a GROUP BY query.  A SELECT ... GROUP
BY without any aggregate behaves like SELECT DISTINCT.  There's
nothing wrong with it.  Performance might be a different story.

BTW, Franco's problem has been recognised as a bug and a patch has
already been published (cf. Tom Lane's mail in this thread).

ServusManfred


pgsql-sql by date:

Previous
From: dev@archonet.com
Date:
Subject: Re: Poor performance on a right join
Next
From: Richard Huxton
Date:
Subject: Re: View - Join based on dis-similar data types