X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 4DFCAD1E298 for ; Tue, 6 Apr 2004 13:51:52 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 34199-04 for ; Tue, 6 Apr 2004 13:51:47 -0300 (ADT) Received: from mail1.elevating.com (wsip-68-99-77-237.tu.ok.cox.net [68.99.77.237]) by svr1.postgresql.org (Postfix) with ESMTP id 3F89ED1D4D5 for ; Tue, 6 Apr 2004 13:51:43 -0300 (ADT) Received: from bretsony.hugheshome.org (bretsony.brets.elevating.com [10.23.0.50]) (authenticated) by mail1.elevating.com (8.11.6/8.11.6) with ESMTP id i36GpbF10825 for ; Tue, 6 Apr 2004 11:51:37 -0500 Subject: Re: group by not returning sorted rows From: Bret Hughes To: postgresql sql list In-Reply-To: <16211.1081204461@sss.pgh.pa.us> References: <1081202143.18380.117.camel@bretsony> <16211.1081204461@sss.pgh.pa.us> Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Mailer: Ximian Evolution 1.0.8 (1.0.8-9.7x.1) Date: 06 Apr 2004 11:51:36 -0500 Message-Id: <1081270297.18380.142.camel@bretsony> Mime-Version: 1.0 X-Elevating-MailScanner: Found to be clean X-Elevating-MailScanner-SpamCheck: not spam, SpamAssassin (score=-1.5, required 5, BAYES_00 -1.50) X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200404/45 X-Sequence-Number: 17420 On Mon, 2004-04-05 at 17:34, Tom Lane wrote: > Bret Hughes 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 Thanks, I replied to Tom directly by accident and did not want the list to think I was ungrateful for the quick reply :) Bret