Re: Question concerning arrays - Mailing list pgsql-general

From Karsten Hilbert
Subject Re: Question concerning arrays
Date
Msg-id 20060628102833.GA6400@merkur.hilbert.loc
Whole thread Raw
In response to Question concerning arrays  ("Christian Rengstl" <Christian.Rengstl@klinik.uni-regensburg.de>)
List pgsql-general
On Tue, Jun 27, 2006 at 01:43:21PM +0200, Christian Rengstl wrote:

> i am in the middle of breaking my head over designing a
> database and came to the following question/problem: i have
> persons whose values (integer) have to be entered in the db,
> but per person the amount of values ranges from 10  to
> around 50. Now my question is if it makes sense, concerning
> performance, to store these integer values in arrays or if
> it is better to change the design so that the values are
> stored separately in fields in tables. I have to add, that
> it is not unlikely (or at least it won't happen very often)
> that select queries will try to find one of those specific
> values, but rather something like select * from persons
> where person_id=...
If each value has a distinct medical meaning (think blood
sugar readings) which makes sense on its own apart from all
the other values it should very likely be stored as a
separate value in the database.

If, however, it is just one integer in a large batch of them
(think raw values of EEG readings) which only really make
sense in conjunction with each other and even then mainly to
the application they should probably be stored as arrays or
some other aggregate datatype. You might still want to query
for single values out of the batch at times - detecting
Ausreißer, fitting curves, detecting peaks of activity, etc.

Karsten

Assistenzarzt für Kinderheilkunde,
Chirurgie und Allgemeinmedizin
Leipzig
--
GPG key ID E4071346 @ wwwkeys.pgp.net
E167 67FD A291 2BEA 73BD  4537 78B9 A9F9 E407 1346

pgsql-general by date:

Previous
From: Thomas Hallgren
Date:
Subject: Re: UUID's as primary keys
Next
From: Martijn van Oosterhout
Date:
Subject: Re: UUID's as primary keys