inheritance performance

From: ken <southerland(at)samsixedd(dot)com>
To: pgsql-performance(at)postgresql(dot)org
Subject: inheritance performance
Date: 2005-01-21 08:19:05
Message-ID: 1106295545.6622.266.camel@pesky.s6portland
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Wondering ...

>From a performance standpoint, is it a bad idea to use inheritance
simply as a tool for easy database building. That is for creating
tables that share the same columns but otherwise are unrelated.

For example, let's say I have the following set of columns that are
common to many of my tables.

objectid int,
createdby varchar(32),
createddate timestamp

... and let's say I create a table with these columns just so that I can
then create other tables that inherit this table so that I have these
columns in it without having to respecify them over and over again
separately for each table that contains them.

>From my understanding, all the data for these columns in all the child
tables will be stored in this one parent table 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.

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?

In other words, if say child table A has 10 million rows in it and child
B has 2 rows in it. Will a query on child table B be slowed down by the
fact that it inherits from the same table as A. I'm sure the answer is
absolutely yes, and so I guess I'm just looking for corroboration.

Maybe I'll be surprised!

Thanks a bunch,

Ken

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Matt Casters 2005-01-21 08:50:46 Re:
Previous Message Tatsuo Ishii 2005-01-21 08:07:31 Re: PostgreSQL clustering VS MySQL clustering