Skip site navigation (1) Skip section navigation (2)

Re: Counting Distinct Records

From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
To: "Thomas F(dot)O'Connell" <tfo(at)sitening(dot)com>
Cc: PgSQL - SQL <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Counting Distinct Records
Date: 2004-11-17 14:52:54
Message-ID: 20041117064813.V17486@megazone.bigpanda.com (view raw or flat)
Thread:
Lists: pgsql-sql
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.

In response to

Responses

pgsql-sql by date

Next:From: Riccardo G. FacchiniDate: 2004-11-17 15:04:26
Subject: Re: session_id
Previous:From: Richard HuxtonDate: 2004-11-17 14:44:51
Subject: Re: session_id

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group