Re: Finding uniques across a big join - Mailing list pgsql-general

From John D. Burger
Subject Re: Finding uniques across a big join
Date
Msg-id 86241f949f391705b946d0422c58588e@mitre.org
Whole thread Raw
In response to Re: Finding uniques across a big join  ("Jim C. Nasby" <jim@nasby.net>)
Responses Re: Finding uniques across a big join
List 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


pgsql-general by date:

Previous
From: Robert Treat
Date:
Subject: Re: Why pgAdmin III guru suggests VACUUM in 8.1
Next
From: Joshua Drake
Date:
Subject: Re: What is the deal with mailing lists?