pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Josh Berkus <josh@agliodbs.com>
To: pgsql-performance@postgresql.org, Don Drake <dondrake@gmail.com>
Subject: Re: Table Partitions: To Inherit Or Not To Inherit
Date: Tue, 16 Nov 2004 21:51:14 -0800
Message-ID: <200411162151.14693.josh@agliodbs.com> (raw)
In-Reply-To: <6c21003b041116213166af022d@mail.gmail.com>
References: <6c21003b041116213166af022d@mail.gmail.com>

Don,

> What's really the difference between this and creating separate tables
> with the same column definition without the inherit, and then create a
> view to "merge" them together?

Easier syntax for queries.   If you created completely seperate tables and 
UNIONED them together, you'd have to be constantly modifying a VIEW which 
tied the tables together.  With inheritance, you just do "SELECT * FROM 
parent_table" and it handles finding all the children for you.

> Also, I've run into a snag in that I have a hourly_detail table, that
> has a foreign key to the hourly_report_data.  The inherit method above
> does not honor the foreign key relationship to the children table of
> hourly_report_data.  I can't insert any data into the hourly_detail
> table due to the constraint failing.

This is a known limitation of inherited tables, at least in current 
implementations.   I think it's on the TODO list.   For now, either live 
without the FKs, or implement them through custom triggers/rules.

-- 
Josh Berkus
Aglio Database Solutions
San Francisco



view thread (2+ messages)

Message-ID: <200411162151.14693.josh@agliodbs.com>
Permalink:  ../200411162151.14693.josh@agliodbs.com/
Also on:    postgresql.org/message-id/200411162151.14693.josh@agliodbs.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: josh@agliodbs.com, dondrake@gmail.com
  Subject: Re: Table Partitions: To Inherit Or Not To Inherit
  In-Reply-To: <200411162151.14693.josh@agliodbs.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