Re: Column as arrays.. more efficient than columns? - Mailing list pgsql-general

From Ow Mun Heng
Subject Re: Column as arrays.. more efficient than columns?
Date
Msg-id 1189129586.17218.19.camel@neuromancer.home.net
Whole thread Raw
In response to Re: Column as arrays.. more efficient than columns?  (Michael Glaesemann <grzm@seespotcode.net>)
Responses Re: Column as arrays.. more efficient than columns?  (Michael Glaesemann <grzm@seespotcode.net>)
List pgsql-general
On Thu, 2007-09-06 at 20:20 -0500, Michael Glaesemann wrote:
> On Sep 6, 2007, at 19:58 , Ow Mun Heng wrote:
>
> > Don't denormalise the table?
>
> Yes. Don't denormalize the tables.

I would believe performance would be better it being denormalised. (in
this case)
>
> > don't put them into arrays?
>
> Yes. Don't use arrays. Caveat: if the data is *naturally* an array
> and you will not be doing any relational operations on individual
> elements of the arrays, then it makes sense to use arrays. Treat
> arrays as you would any other opaque type.

Data is naturally an array, and will be used as an array in any case.
Since there will not be queries where users will select any one of the
values in that array, but the whole array itself.

data willbe used in this form

code   | v1 | v2 | v3 | v4
A         1    2   10   23
B         10   12  15   22
C         11   24  18   46
D         21   22  20   41

which will be imported into statistical software/excel for further
manipulation.

I i give them in the denormalised form, it'll take them an addition
30min or so to make them back into the form above.

and it'll make the queries more efficient too.

index on Code,
select * from foo where code = 'B';

By denormalising, I will also get the benefit of reducing the # of rows
by a factor of 20.. (20 rows  = 1 code)


pgsql-general by date:

Previous
From: Michael Glaesemann
Date:
Subject: Re: Column as arrays.. more efficient than columns?
Next
From: "Merlin Moncure"
Date:
Subject: Re: Column as arrays.. more efficient than columns?