Skip site navigation (1) Skip section navigation (2)

Re: group by not returning sorted rows

From: Bret Hughes <bhughes(at)elevating(dot)com>
To: postgresql sql list <pgsql-sql(at)postgresql(dot)org>
Subject: Re: group by not returning sorted rows
Date: 2004-04-06 16:51:36
Message-ID: 1081270297.18380.142.camel@bretsony (view raw, whole thread or download thread mbox)
Lists: pgsql-sql
On Mon, 2004-04-05 at 17:34, Tom Lane wrote:
> Bret Hughes <bhughes(at)elevating(dot)com> writes:
> > and the rows resulting from the query are no longer sorted by log date. 
> > Is this a change since 7.2x?
> Yes.  7.4 can use hashing instead of sorting to bring grouped rows
> together.
> > I can achieve the results I need by adding an order by clause identical
> > to the group by but this seems counter intuitive since the rows have to
> > be ordered anyway.
> No they don't; you're making an assumption about the implementation that
> is no longer warranted.  The SQL spec doesn't require it either ...
> output ordering is only guaranteed if you specify ORDER BY, per spec.
> 			regards, tom lane


I replied to Tom directly by accident and did not want the list to think
I was ungrateful for the quick reply :)


In response to

pgsql-sql by date

Next:From: Bret HughesDate: 2004-04-06 17:06:34
Subject: distinct values without seq scan
Previous:From: Robert TreatDate: 2004-04-06 16:38:41
Subject: Re: partial unique constraint

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group