Re: Inheritance - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Inheritance
Date
Msg-id 7694.1029333555@sss.pgh.pa.us
Whole thread Raw
In response to Re: Inheritance  ("Christopher Kings-Lynne" <chriskl@familyhealth.com.au>)
Responses Re: Inheritance  (Greg Copeland <greg@CopelandConsulting.Net>)
List pgsql-hackers
"Christopher Kings-Lynne" <chriskl@familyhealth.com.au> writes:
> Is it theoretically possible to add support to btree for storing table along
> with the indexed value?

That's what we need, all right.

> This would obviously add overhead, so it would only
> be done for spanning indexes.  The index would also take up more space on
> disk I guess.
> When a new inherited table is created, all parent indices would be dropped
> and recreated as spanning indices and vice versa.

Seems like the hard way.  Instead use a t_infomask bit in indextuples to
indicate that the index entry points to a table other than the one its
index is nominally associated with; if and only if this bit is set, the
table OID follows the indextuple header.  This way, you don't have to
reindex just to create a child table, and you also don't pay any extra
space cost for index entries that in fact point at the parent.

There are a veritable ton of other issues to be resolved --- like how do
we (efficiently) find all the indexes relevant to a given child table
--- but the physical storage doesn't seem too complicated.
        regards, tom lane


pgsql-hackers by date:

Previous
From: ngpg@grymmjack.com
Date:
Subject: Re: Open 7.3 items
Next
From: Joe Conway
Date:
Subject: Re: Open 7.3 items