X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 25604D1B7C9 for ; Sun, 13 Jun 2004 00:40:05 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 49540-10 for ; Sun, 13 Jun 2004 03:40:01 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 124D9D1B7C8 for ; Sun, 13 Jun 2004 00:39:58 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.11/8.12.11) with ESMTP id i5D3dtCV021367; Sat, 12 Jun 2004 23:39:55 -0400 (EDT) To: Vitaly Belman Cc: pgsql-performance@postgresql.org Subject: Re: Additional select fields in a GROUP BY In-reply-to: <2393942843.20040613062117@012.net.il> References: <2393942843.20040613062117@012.net.il> Comments: In-reply-to Vitaly Belman message dated "Sun, 13 Jun 2004 06:21:17 +0300" Date: Sat, 12 Jun 2004 23:39:55 -0400 Message-ID: <21366.1087097995@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200406/142 X-Sequence-Number: 7200 Vitaly Belman writes: > The problem is that addind them all to GROUP BY causes a performance > loss. Really? I'd think that there'd be no visible loss if the earlier fields of the GROUP BY are already unique. The sort comparison should stop at the first field that determines the sort order. Can you provide a self-contained example? regards, tom lane