Re: [PATCHES] Adding fulldisjunctions to the contrib

From: Tzahi Fadida <Tzahi(dot)ML(at)gmail(dot)com>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCHES] Adding fulldisjunctions to the contrib
Date: 2006-08-12 01:52:01
Message-ID: 200608120452.02573.Tzahi.ML@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

On Friday 11 August 2006 07:18, Bruce Momjian wrote:
> I have looked over this addition, and I think I finally understand it.
> Given three tables, A, B, C, which join as A->B, B->C, C->A, you can
> really join them as A->B->C, and A->C->B. What full disjunction does is
> to perform both of those joins, and return a one row for each join. Here

What it does is to return all the possible natural joins, i.e.:
A
B
C
A,B
A,C
...
A,B,C

And, it removes any redundant information so that if we have a tuple
that already contains another tuple's information that tuple is discarded.
Also, note that the full disjunction algorithm i implemented
is commonly used in cases where the scheme graph is cyclic
and thus, you cannot use natural full outer join
to compute the FD.

Finally, you can FD(A,B,C,D,...) any number of relations (limited to 32 in
the implementation) with no regard to the order between them.

A case study and comparison can be found here:
http://www.technion.ac.il/~tzahi/soc.html

> is an example from the README:
>
> Example of an input and output of a full disjunctions:
> INPUT:
>
> --A---|---B---|---C--
> X---Y-|-Y---Z-|-X---Z
> a-|-b-|-b-|-c-|-a-|-d
>
> A,B and C are relations. X,Y and Z are attributes. a,b,c and d are
> values.
>
> Note that A,B and C are connected in a cycle. That is:
> A is connected to B on attribute Y,
> B is connected to C on attribute Z,
> C is connected to A on attribute X.
>
> The output of the full disjunctions FD(A,B,C):
>
> FD
> X---Y---Z
> a-|-b-|-c
> a-|-b-|-d
>
> This code is pretty complex, so I can see why it should be in /contrib.
> Are there reasonable use cases for this capability?
>
> ---------------------------------------------------------------------------
>
> Tzahi Fadida wrote:
> > Hi,
> > I wish to add the fulldisjunctions function to the contrib.
> > With the help of Jonah, we (or rather he :) created a patch with
> > regression tests. The function is finished programmatically but
> > still a little more code documentation touches and improved error
> > messages are needed. All the rest was extensively tested.
> >
> > Attached is the patch.
> >
> > Works great. Just compiled from a fresh cvs which i patched with the
> > attached diff. ran the fulldijsjunction.sql in the
> > share/contrib/fulldisjunction and let it run and it works great.
> > 10x.
> >
> > --
> > Regards,
> > ????????Tzahi.
> > --
> > Tzahi Fadida
> > Blog: http://tzahi.blogsite.org | Home Site: http://tzahi.webhop.info
> > WARNING TO SPAMMERS: ?see at
> > http://members.lycos.co.uk/my2nis/spamwarning.html
>
> [ Attachment, skipping... ]
>
> > ---------------------------(end of broadcast)---------------------------
> > TIP 3: Have you checked our extensive FAQ?
> >
> > http://www.postgresql.org/docs/faq

--
Regards,
        Tzahi.
--
Tzahi Fadida
Blog: http://tzahi.blogsite.org | Home Site: http://tzahi.webhop.info
WARNING TO SPAMMERS:  see at
http://members.lycos.co.uk/my2nis/spamwarning.html

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2006-08-12 02:58:12 psql and INSERT/UPDATE/DELETE RETURNING
Previous Message Alvaro Herrera 2006-08-12 01:42:58 Re: pgstattuple extension for indexes

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2006-08-12 03:49:33 Re: [HACKERS] New variable server_version_num
Previous Message Alvaro Herrera 2006-08-12 01:42:58 Re: pgstattuple extension for indexes