Re: Table inheritance implementation.

From: Grzegorz Nowakowski <krecik(at)e-wro(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Table inheritance implementation.
Date: 2007-01-05 08:27:31
Message-ID: 1167985651.15397.15.camel@rohlik
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On czw, 2007-01-04 at 10:44 -0500, Tom Lane wrote:
> Grzegorz Nowakowski <krecik(at)e-wro(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Devrim GUNDUZ 2007-01-05 09:09:32 Re: Dependency conflicts on CentOS 4.4
Previous Message Gunnar Wagenknecht 2007-01-05 06:48:17 Re: Dependency conflicts on CentOS 4.4