Inheritance vs child tables (Was Domains) - Mailing list pgsql-general

From Francisco J Reyes
Subject Inheritance vs child tables (Was Domains)
Date
Msg-id 20030802140600.G99004@zoraida.natserv.net
Whole thread Raw
In response to Re: Domains (Was [PERFORM] Views With Unions)  (Ron Johnson <ron.l.johnson@cox.net>)
List pgsql-general
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.

pgsql-general by date:

Previous
From: "Francisco Figueiredo Jr."
Date:
Subject: Re: Is there support for output parameters?
Next
From: Francisco J Reyes
Date:
Subject: Re: plPHP -- sort of an announcement.. but not commercial