Re: inheritance performance

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Greg Stark <gsstark(at)mit(dot)edu>
Cc: ken <southerland(at)samsixedd(dot)com>, pgsql-performance(at)postgresql(dot)org
Subject: Re: inheritance performance
Date: 2005-01-22 20:22:22
Message-ID: 24996.1106425342@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Greg Stark <gsstark(at)mit(dot)edu> writes:
> ken <southerland(at)samsixedd(dot)com> writes:
>> From my understanding, all the data for these columns in all the child
>> tables will be stored in this one parent table

> No, all the data is stored in the child table.

Correct ...

>> and that, furthermore, there is a "hidden" column in the parent table called
>> tableoid that allows postgres to determine which row is stored in which
>> child table.

> That's true.
> There's a performance hit for the extra space required to store the tableoid.

Bzzzt ...

tableoid isn't actually stored anywhere on disk. It's a pseudo-column
that is generated during row fetch. (It works for all tables, not only
inheritance children.)

>> Given that, is there a performance hit for queries on the child tables
>> because postgres has to effectively put a condition on every query based on
>> the tableoid of the given child table?

AFAIR, a query directed specifically to a child table is *completely*
unaware of the fact that that table is a child. Only queries directed
to a parent table, which have to implicitly UNION in the children, pay
any price for inheritance.

regards, tom lane

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2005-01-22 21:10:23 Re: PostgreSQL clustering VS MySQL clustering
Previous Message Jim C. Nasby 2005-01-22 20:10:49 Re: PostgreSQL clustering VS MySQL clustering