Re: triggers vs b-tree - Mailing list pgsql-general

From Joris Dobbelsteen
Subject Re: triggers vs b-tree
Date
Msg-id 73427AD314CC364C8DF0FFF9C4D693FF5523@nehemiah.joris2k.local
Whole thread Raw
In response to triggers vs b-tree  (gustavo halperin <ggh.develop@gmail.com>)
List pgsql-general
I believe you should design it in a slightly different way:

>-----Original Message-----
>From: pgsql-general-owner@postgresql.org
>[mailto:pgsql-general-owner@postgresql.org] On Behalf Of
>gustavo halperin
>Sent: donderdag 25 januari 2007 21:34
>To: pgsql-general@postgresql.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

pgsql-general by date:

Previous
From: "Joris Dobbelsteen"
Date:
Subject: Re: Duplicate key violation
Next
From: Louis-David Mitterrand
Date:
Subject: DBI support for pg native arrays?