Re: triggers vs b-tree

From: "Joris Dobbelsteen" <Joris(at)familiedobbelsteen(dot)nl>
To: "gustavo halperin" <ggh(dot)develop(at)gmail(dot)com>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: triggers vs b-tree
Date: 2007-01-26 10:58:40
Message-ID: 73427AD314CC364C8DF0FFF9C4D693FF5523@nehemiah.joris2k.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I believe you should design it in a slightly different way:

>-----Original Message-----
>From: pgsql-general-owner(at)postgresql(dot)org
>[mailto:pgsql-general-owner(at)postgresql(dot)org] On Behalf Of
>gustavo halperin
>Sent: donderdag 25 januari 2007 21:34
>To: pgsql-general(at)postgresql(dot)org
>Subject: [GENERAL] triggers vs b-tree
>
>Hello I have a design question:
>
> I have a table representing Families, and a table
>representing Persons.
>
> So my question is: If most of the time I need to find all the
>persons for one asked family what is the best way to do that?
> I think about two methods:
> 1- Making a b-tree index in ficha_person with the
>rows family_id and person_id.
> 2 - Adding an array in the table ficha_family
>containing the persons of this family. And creating a Trigger
>that update this array for each person insert/delete in the
>table ficha_family.

It seems you are quite new (or unfamiliar) to databases.
Are you familiar with "Database Normalization"?

Read this:
http://databases.about.com/od/specificproducts/a/normalization.htm
(Handles all you need)
http://www.phlonx.com/resources/nf3/
(Gives better examples up to 3th normal form)
http://en.wikipedia.org/wiki/Database_normalization
(Wikipedia does not seem to be too good, but it works)

After reading this carefully you should know what option you should
take. The answer is right in there, but there is a lot more useful
information too.

- Joris

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Louis-David Mitterrand 2007-01-26 11:00:42 DBI support for pg native arrays?
Previous Message Joris Dobbelsteen 2007-01-26 10:55:20 Re: Duplicate key violation