Re: [Bizgres-general] A Guide to Constraint Exclusion (

From: "Luke Lonergan" <llonergan(at)greenplum(dot)com>
To: "Simon Riggs" <simon(at)2ndquadrant(dot)com>
Cc: "Hannu Krosing" <hannu(at)skype(dot)net>, "bizgres-general" <bizgres-general(at)pgfoundry(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [Bizgres-general] A Guide to Constraint Exclusion (
Date: 2005-07-14 22:44:58
Message-ID: BEFC38FA.8B70%llonergan@greenplum.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Simon,

> It's the first time I've thought to compare the constraint predicates on
> joined tables based upon the join restriction. That's possible, but
> would take some time to work out.
>
> I've argued that such a construct is not common. I'm open to suggestions
> about what *is* common...

I also don't believe it is commonly used. There are occasions where fact
tables are joined on a common key, but for CE to be effective, the key would
have to be used in a similar way in constructing the partitions.

There are many other ways to accomplish useful patterns, like partitioning
fact tables based on a date based key, then using a constant predicate in
the join, e.g:

SELECT * FROM Fact AND Dimension
WHERE Fact.a = Dimension.a
AND to_char(T1.key,"MONTH") = 'JUNE'
AND to_char(T1.key,"YYYY") = '2003';

With Fact defined with 12 partitions
CHECK(to_char(key,"MONTH") EQUAL 'JANUARY')
...
CHECK(to_char(key,"MONTH") EQUAL 'DECEMBER')

- Luke

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2005-07-14 22:49:33 Re: [Bizgres-general] A Guide to Constraint Exclusion
Previous Message Simon Riggs 2005-07-14 22:30:08 Re: [Bizgres-general] A Guide to Constraint Exclusion