Re: Finding uniques across a big join

From: "John D(dot) Burger" <john(at)mitre(dot)org>
To: PostgreSQL general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Finding uniques across a big join
Date: 2005-11-30 18:29:17
Message-ID: 86241f949f391705b946d0422c58588e@mitre.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Jim C. Nasby wrote:

> It will probably be a win to come up with a list of potential records
> from each table, instead of after doing the 3-way join. so something
> like:
>
> (SELECT gazPlaceID FROM gazPlaces GROUP BY featureType HAVING
> count(*)=1)
> JOIN
> (SELECT ...)

Hmm, not sure I understand. Joining the uniques wrt each of the three
columns does not result in the unique triples, or even a superset of
them, at least in this case.

> If you post the output of explain (or explain analyze is even better)
> then people could probably make better suggestions.

Okay, I just posted the query plan. I will try to run an EXPLAIN
ANALYZE tonight.

Again, I'm also interested in completely different approaches to
discovering the entities with unique attribute combinations.
Intuitively, the query I posted is doing "too much work", because it's
computing the total count for each combo, when all I really need is to
know if the count is 1 or greater than 1.

Thanks!

- John Burger
MITRE

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Uwe C. Schroeder 2005-11-30 18:29:31 Re: Question
Previous Message Jim C. Nasby 2005-11-30 18:24:40 Re: How to check options PostgreSQL was started with