X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id B4073D1C91F for ; Sat, 2 Aug 2003 18:20:59 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 42657-05 for ; Sat, 2 Aug 2003 15:19:49 -0300 (ADT) Received: from mail1.acecape.com (mail1.acecape.com [66.114.74.12]) by svr1.postgresql.org (Postfix) with ESMTP id A47A5D1C4E1 for ; Sat, 2 Aug 2003 15:20:57 -0300 (ADT) Received: from p65-147.acedsl.com (p65-147.acedsl.com [66.114.65.147]) by mail1.acecape.com (8.12.9/8.12.9) with ESMTP id h72IKv0H019908; Sat, 2 Aug 2003 14:20:57 -0400 Date: Sat, 2 Aug 2003 14:22:39 -0400 (EDT) From: Francisco J Reyes To: Ron Johnson Cc: pgsql General List Subject: Inheritance vs child tables (Was Domains) In-Reply-To: <1059782193.22384.85.camel@haggis> Message-ID: <20030802140600.G99004@zoraida.natserv.net> References: <20030801075335.D51229-100000@megazone.bigpanda.com> <60vfthl6q6.fsf@dev6.int.libertyrms.info> <16388.1059756693@sss.pgh.pa.us> <20030801131642.Q93127@zoraida.natserv.net> <1059782193.22384.85.camel@haggis> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200308/125 X-Sequence-Number: 46542 On Fri, 1 Aug 2003, Ron Johnson wrote: > On Fri, 2003-08-01 at 12:26, Francisco J Reyes wrote: > > On Fri, 1 Aug 2003, Tom Lane wrote: > [snip] > > Currently I used inheritance to enforce the consitency > > since a good number of fields needed to be common among the tables AND the > > inheritted tables are basically a supperset of the data, so some times I > > would want to access the inheritted tables and other times the parent/main > > table. > > Isn't this when you'd really want child tables, instead? I think both ways can accomplish the same (if not very simmilar functionality), however I find using inherittance easier. Not really sure about efficiency though. A simple example of the type of design I am planning to do would be: Table A Userid date entered last changed Table B inherited from A(additional fields) person name birthday Table C inherited from A(additional fields) book isbn comment I plan to keep track of how many records a user has so with inherittance it's easy to do this. I can count for the user in Table A and find out how many records he/she has or I can count in each of the inheritted tables and see how many there are for that particular table. Inheritance makes it easier to see everything for a userid or just a particular type of records.