From: Tom Lane <tgl@sss.pgh.pa.us>
To: Bret Hughes <bhughes@elevating.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: group by not returning sorted rows
Date: Mon, 05 Apr 2004 18:34:21 -0400
Message-ID: <16211.1081204461@sss.pgh.pa.us> (raw)
In-Reply-To: <1081202143.18380.117.camel@bretsony>
References: <1081202143.18380.117.camel@bretsony>
Bret Hughes <bhughes@elevating.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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: tgl@sss.pgh.pa.us, bhughes@elevating.com
Subject: Re: group by not returning sorted rows
In-Reply-To: <16211.1081204461@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox