Re: Table inheritance implementation. - Mailing list pgsql-general

From Grzegorz Nowakowski
Subject Re: Table inheritance implementation.
Date
Msg-id 1167985651.15397.15.camel@rohlik
Whole thread Raw
In response to Re: Table inheritance implementation.  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Table inheritance implementation.  (Martijn van Oosterhout <kleptog@svana.org>)
List pgsql-general
On czw, 2007-01-04 at 10:44 -0500, Tom Lane wrote:
> Grzegorz Nowakowski <krecik@e-wro.net> writes:
> > But I have another question: why can't be
> > inheritance implemented as implicit JOIN?
>
> Interesting thought, but joins are expensive --- this would be quite a
> lot slower than the current way, I fear, especially when you consider
> more than one level of inheritance.  Also, switching over to this would
> destroy the current usefulness of inheritance for partitioning.

Well, I never used partitioning and I don't know what it's worth but
just after sending my original mail I got another variant of the idea:
to duplicate columns (parent(p), child(p,c)), so inserts into child
update both parent's and child's index.  This way we trade space (common
columns are replicated along inheritance hierarchy) and some speed
(inserts into child are slower because they also have to update parent)
for some other speed (selects work without join penalty).  Yet still we
have the primary benefit: parent's constraints and indexes work as
expected.

I'm well aware that even if my idea has some merit, it won't be soon
when it goes into code, if ever.  I expect it would take small
revolution to make it.  Anyway, I tried.  :)

Best regards.
--
Grzegorz Nowakowski


pgsql-general by date:

Previous
From: Gunnar Wagenknecht
Date:
Subject: Re: Dependency conflicts on CentOS 4.4
Next
From: Devrim GUNDUZ
Date:
Subject: Re: Dependency conflicts on CentOS 4.4