X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id BBF843A401E for ; Wed, 17 Nov 2004 14:52:59 +0000 (GMT) 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 91205-06 for ; Wed, 17 Nov 2004 14:52:50 +0000 (GMT) Received: from megazone.bigpanda.com (megazone.bigpanda.com [64.147.171.210]) by svr1.postgresql.org (Postfix) with ESMTP id 6F3CF3A3F94 for ; Wed, 17 Nov 2004 14:52:54 +0000 (GMT) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id D013C35961; Wed, 17 Nov 2004 06:52:54 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id CEA8235925; Wed, 17 Nov 2004 06:52:54 -0800 (PST) Date: Wed, 17 Nov 2004 06:52:54 -0800 (PST) From: Stephan Szabo To: "Thomas F.O'Connell" Cc: PgSQL - SQL Subject: Re: Counting Distinct Records In-Reply-To: Message-ID: <20041117064813.V17486@megazone.bigpanda.com> References: <1B2F7B00-3808-11D9-95C2-000D93AE0944@sitening.com> <20041116115807.E79990@megazone.bigpanda.com> <6E79C2FE-380B-11D9-95C2-000D93AE0944@sitening.com> <20041116141911.K84773@megazone.bigpanda.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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: 200411/174 X-Sequence-Number: 19493 On Tue, 16 Nov 2004, Thomas F.O'Connell wrote: > Hmm. I was more interested in using COUNT( * ) than DISTINCT *. > > I want a count of all rows, but I want to be able to specify which > columns are distinct. I'm now a bit confused about exactly what you're looking for in the end. Can you give a short example? > That's definitely an interesting approach, but testing doesn't show it > to be appreciably faster. > > If I do a DISTINCT *, postgres will attempt to guarantee that there are > no duplicate values across all columns rather than a subset of columns? > Is that right? It guarantees one output row for each distinct set of column values across all columns.