pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Francisco J Reyes <fran@natserv.net>
To: Ron Johnson <ron.l.johnson@cox.net>
Cc: pgsql General List <pgsql-general@postgresql.org>
Subject: Inheritance vs child tables (Was Domains)
Date: Sat, 2 Aug 2003 14:22:39 -0400 (EDT)
Message-ID: <20030802140600.G99004@zoraida.natserv.net> (raw)
In-Reply-To: <1059782193.22384.85.camel@haggis>
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>

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.



view thread (3+ messages)  latest in thread

Message-ID: <20030802140600.G99004@zoraida.natserv.net>
Permalink:  ../20030802140600.G99004@zoraida.natserv.net/
Also on:    postgresql.org/message-id/20030802140600.G99004@zoraida.natserv.net

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-performance@postgresql.org
  Cc: fran@natserv.net, ron.l.johnson@cox.net, pgsql-general@postgresql.org
  Subject: Re: Inheritance vs child tables (Was Domains)
  In-Reply-To: <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> <20030802140600.G99004@zoraida.natserv.net>

* 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