drawback of array vs join

From: Ivan Sergio Borgonovo <mail(at)webthatworks(dot)it>
To: pgsql-general(at)postgresql(dot)org
Subject: drawback of array vs join
Date: 2009-06-23 14:35:39
Message-ID: 20090623163539.42526021@dawn.webthatworks.it
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I've a temporary table where I'd like to resume data coming from
several other tables (normalised the usual way).
eg.
a list of items that may belong to several group (eg. item,
group, itemgroup table) will end up in something similar to:

create temp table itemlisttemp(
lid int,
iid int,
qty int,
famid int,
rating int,
itemgroups int[],
);

This because I've to loop over the same table several times and
because it *should* make easier to write dynamic queries [built from
a web interface] like

select sum(qty) from where
famid=3
and rating>0
and 10 = any itemgroups
...

itemlisttemp tables will be very small (30 as an upper limit) and
arrays as well will contain very few elements (4 as an upper limit).

I'm aware of the drawback of de-normalization.

Should I be aware of anything else when using arrays this way?

thanks

--
Ivan Sergio Borgonovo
http://www.webthatworks.it

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2009-06-23 14:36:23 Re: Information about columns
Previous Message Grzegorz Jaśkiewicz 2009-06-23 14:29:50 Re: Please suggest me on my table design (indexes!)