Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id 6E9F19FA173 for ; Wed, 20 Dec 2006 11:36:52 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-new, port 10024) with ESMTP id 78882-01 for ; Wed, 20 Dec 2006 11:36:35 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 075429F9C35 for ; Wed, 20 Dec 2006 11:36:40 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id kBKFacd0022280; Wed, 20 Dec 2006 10:36:38 -0500 (EST) To: "Peter Childs" cc: "Postgresql Performance" Subject: Re: GROUP BY vs DISTINCT In-reply-to: References: <20061220071940.17382.qmail@web52303.mail.yahoo.com> <20061220105739.GB31739@uio.no> Comments: In-reply-to "Peter Childs" message dated "Wed, 20 Dec 2006 11:16:40 +0000" Date: Wed, 20 Dec 2006 10:36:38 -0500 Message-ID: <22279.1166628998@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200612/489 X-Sequence-Number: 22545 "Peter Childs" writes: > Is it actually in the sql spec to sort in a distinct No. PG's code that supports GROUP BY is newer and smarter than the code that supports DISTINCT, is all. One of the things on the to-do list is to revise DISTINCT so it can also consider hash-based implementations. The hard part of that is not to break DISTINCT ON ... regards, tom lane