Re: [Bizgres-general] A Guide to Constraint Exclusion - Mailing list pgsql-hackers

From Hannu Krosing
Subject Re: [Bizgres-general] A Guide to Constraint Exclusion
Date
Msg-id 1121330912.4875.2.camel@fuji.krosing.net
Whole thread Raw
In response to Re: [Bizgres-general] A Guide to Constraint Exclusion  (Hannu Krosing <hannu@tm.ee>)
List pgsql-hackers
On N, 2005-07-14 at 00:13 +0300, Hannu Krosing wrote:
> On K, 2005-07-13 at 11:53 +0100, Simon Riggs wrote:
> 
> > 
> > We aren't able to exclude the parent table from the above query because
> > no Constraint was defined upon it. Since, in our example, the parent is
> > empty there will be little effect on the query performance. It would be
> > a mistake to attempt to get around this by placing a Constraint on the
> > parent, since that would then automatically be created on all child
> > tables also. So we can never exclude the parent without automatically
> > excluding *all* of the children also.

hannu=# create table ttt(id serial, t text);
NOTICE:  CREATE TABLE will create implicit sequence "ttt_id_seq" for
"serial" co lumn "ttt.id"
CREATE TABLE
hannu=# create table ttt2() inherits (ttt);
CREATE TABLE
hannu=# alter table ONLY ttt add constraint ccc check(false);
ALTER TABLE

this also works, but new inherited tables will still inherit the
constraint.

Perhaps we just need a way to store the "ONLY" status of the constraint,
and then not inherit these.

-- 
Hannu Krosing <hannu@skype.net>



pgsql-hackers by date:

Previous
From: Hannu Krosing
Date:
Subject: Re: CONCURRENT INDEXing again (was: Must be owner to
Next
From: Hannu Krosing
Date:
Subject: Re: Order by optimisations?