X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 217833A4276 for ; Wed, 17 Nov 2004 05:52:35 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 33925-10 for ; Wed, 17 Nov 2004 05:52:26 +0000 (GMT) Received: from davinci.ethosmedia.com (server226.ethosmedia.com [209.128.84.226]) by svr1.postgresql.org (Postfix) with ESMTP id F0D273A41F1 for ; Wed, 17 Nov 2004 05:52:26 +0000 (GMT) Received: from [63.195.55.98] (account josh@agliodbs.com HELO spooky) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) with ESMTP id 6671957; Tue, 16 Nov 2004 21:53:56 -0800 From: Josh Berkus Organization: Aglio Database Solutions To: pgsql-performance@postgresql.org, Don Drake Subject: Re: Table Partitions: To Inherit Or Not To Inherit Date: Tue, 16 Nov 2004 21:51:14 -0800 User-Agent: KMail/1.6.2 References: <6c21003b041116213166af022d@mail.gmail.com> In-Reply-To: <6c21003b041116213166af022d@mail.gmail.com> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200411162151.14693.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200411/240 X-Sequence-Number: 9194 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