Re: join removal - Mailing list pgsql-hackers

From Lawrence, Ramon
Subject Re: join removal
Date
Msg-id 6EEA43D22289484890D119821101B1DF05191043@exchange20.mercury.ad.ubc.ca
Whole thread Raw
In response to Re: join removal  (Greg Stark <stark@mit.edu>)
List pgsql-hackers
> I took at a first crack at coding up an implementation of
> relation_is_distinct_for() tonight.

I am not sure if this will help or not, but on the 8.4 code base we
implemented two functions:

- getCandidateKeys() - would recursively traverse a tree from a given
node to the leaf nodes and determine the candidate keys for the
intermediate relation produced by that node

- getJoinCard() - determined the join cardinality of a hash join node
(1:1, 1:N, etc.) based on the candidate keys of the two input relations

It worked pretty well for our tests with equi-joins, but I am sure it is
missing many cases.  I have attached the code which we used
(cardinalityFuncs.c).  Some of the helper functions may also be useful
(convertUniqueIndexesToCandidateKeys, getJoinAttrs).

--
Ramon Lawrence


Attachment

pgsql-hackers by date:

Previous
From: "Kevin Grittner"
Date:
Subject: Re: Alpha releases: How to tag
Next
From: Bruce Momjian
Date:
Subject: Re: Shipping documentation untarred