Re: [HACKERS] Re: Improve OR conditions on joined columns (common star schema problem) - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [HACKERS] Re: Improve OR conditions on joined columns (common star schema problem)
Date
Msg-id 31463.1489953251@sss.pgh.pa.us
Whole thread Raw
In response to Re: [HACKERS] Re: Improve OR conditions on joined columns (common star schema problem)  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
I wrote:
> Consider
>     SELECT count(*)
>     FROM a FULL JOIN b ON (a.id = b.id)
>     WHERE (a.x = 42 OR b.y = 43);
> and suppose that a and b have mutual FK constraints guaranteeing that
> every non-null a.id value has exactly one match in b and vice versa.

Oh, that was sloppy of me.  Join removal depends on unique constraints
not FK constraints.  So actually, this example just requires assuming
that both a.id and b.id are known unique, which is much less far-fetched
than assuming circular FK constraints.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Andreas Karlsson
Date:
Subject: Re: [HACKERS] Removing binaries (was: createlang/droplang deprecated)
Next
From: Stephen Frost
Date:
Subject: Re: [HACKERS] Removing binaries (was: createlang/droplang deprecated)