Re: Putting many related fields as an array

Поиск
Список
Период
Сортировка
От Ow Mun Heng
Тема Re: Putting many related fields as an array
Дата
Msg-id D1109E8B2FB53A45BDB60F8145905CE901CE35D3@wdmyexbe03.my.asia.wdc.com
обсуждение исходный текст
Ответ на Re: Putting many related fields as an array  (Sam Mason <sam@samason.me.uk>)
Ответы Re: Putting many related fields as an array  (Sam Mason <sam@samason.me.uk>)
Re: Putting many related fields as an array  (Andrew Gould <andrewlylegould@gmail.com>)
Список pgsql-general
-----Original Message-----
From: pgsql-general-owner@postgresql.org [mailto:pgsql-general-
On Tue, May 12, 2009 at 01:23:14PM +0800, Ow Mun Heng wrote:
>> | sum of count | sum_of_count_squared | qty | qty < 100 | qty < 500 |
>>
>>
>> I'm thinking of lumping them into 1 column via an array instead of into
>> 5 different columns. Not sure how to go about this, hence the email to
>> the list.

>The normal array constructor should work:
>
>  SELECT ARRAY[MIN(v),MAX(v),AVG(v),STDEV(v)]
>  FROM (VALUES (1),(3),(4)) x(v);
>
>Not sure why this is better than using separate columns though.  Maybe a
>new datatype and a custom aggregate would be easier to work with?

The issue here is the # of columns needed to populate the table.

The table I'm summarizing has close to between 50 to 100+ columns, if the
1:5x is used as a yardstick, then the table will get awfully wide quickly.

I need to know how to do it first, then test accordingly for performance and
corner cases.



В списке pgsql-general по дате отправления:

Предыдущее
От: CM J
Дата:
Сообщение: Postgres BackUp and Restore: ERROR: duplicate key violates unique constraint "pg_largeobject_loid_pn_index"
Следующее
От: Henry
Дата:
Сообщение: Cannot login for short period of time