pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Greg Stark <gsstark@mit.edu>
Cc: ken <southerland@samsixedd.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: inheritance performance
Date: Sat, 22 Jan 2005 15:22:22 -0500
Message-ID: <24996.1106425342@sss.pgh.pa.us> (raw)
In-Reply-To: <87hdlaahez.fsf@stark.xeocode.com>
References: <1106295545.6622.266.camel@pesky.s6portland>
	<87hdlaahez.fsf@stark.xeocode.com>

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



view thread (8+ messages)

Message-ID: <24996.1106425342@sss.pgh.pa.us>
Permalink:  ../24996.1106425342@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/24996.1106425342@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: tgl@sss.pgh.pa.us, gsstark@mit.edu, southerland@samsixedd.com
  Subject: Re: inheritance performance
  In-Reply-To: <24996.1106425342@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox