pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Greg Stark <gsstark@mit.edu>
To: ken <southerland@samsixedd.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: inheritance performance
Date: 21 Jan 2005 11:14:12 -0500
Message-ID: <87hdlaahez.fsf@stark.xeocode.com> (raw)
In-Reply-To: <1106295545.6622.266.camel@pesky.s6portland>
References: <1106295545.6622.266.camel@pesky.s6portland>


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.

> 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.

> 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?

There's a performance hit for the extra space required to store the tableoid.
This means slightly fewer records will fit on a page and i/o requirements will
be slightly higher. This will probably only be noticeable on narrow tables,
and even then probably only on large sequential scans.

There's also a slight performance hit because there's an optimization that the
planner does normally for simple queries that isn't currently done for either
UNION ALL or inherited tables. I think it's planned to fix that soon.

> 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.

No, it isn't slowed down by the records in A. It's slightly slower because it
is an inherited table, but that impact is the same regardless of what other
tables inherit from the same parent and how many records are in them.

-- 
greg




view thread (8+ messages)  latest in thread

Message-ID: <87hdlaahez.fsf@stark.xeocode.com>
Permalink:  ../87hdlaahez.fsf@stark.xeocode.com/
Also on:    postgresql.org/message-id/87hdlaahez.fsf@stark.xeocode.com

 · 

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: gsstark@mit.edu, southerland@samsixedd.com
  Subject: Re: inheritance performance
  In-Reply-To: <87hdlaahez.fsf@stark.xeocode.com>

* 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