Re: join removal

From: "Lawrence, Ramon" <ramon(dot)lawrence(at)ubc(dot)ca>
To: "Robert Haas" <robertmhaas(at)gmail(dot)com>
Cc: <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: join removal
Date: 2009-08-10 15:30:44
Message-ID: 6EEA43D22289484890D119821101B1DF05191043@exchange20.mercury.ad.ubc.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 Content-Type Size
cardinalityFuncs.c application/octet-stream 15.9 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2009-08-10 15:32:26 Re: WIP: to_char, support for EEEE format
Previous Message Andrew Dunstan 2009-08-10 15:29:58 Re: [PATCH] "could not reattach to shared memory" on Windows