Re: inheritance performance - Mailing list pgsql-performance

From Tom Lane
Subject Re: inheritance performance
Date
Msg-id 24996.1106425342@sss.pgh.pa.us
Whole thread Raw
In response to Re: inheritance performance  (Greg Stark <gsstark@mit.edu>)
List pgsql-performance
Greg Stark <gsstark@mit.edu> writes:
> ken <southerland@samsixedd.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

pgsql-performance by date:

Previous
From: "Jim C. Nasby"
Date:
Subject: Re: PostgreSQL clustering VS MySQL clustering
Next
From: Tom Lane
Date:
Subject: Re: PostgreSQL clustering VS MySQL clustering