Re: Ways to deal with large amount of columns;

Поиск
Список
Период
Сортировка
От a
Тема Re: Ways to deal with large amount of columns;
Дата
Msg-id tencent_2EB8658617C930525A0A9C8E@qq.com
обсуждение исходный текст
Ответ на Re: Ways to deal with large amount of columns;  ("David G. Johnston" <david.g.johnston@gmail.com>)
Ответы Re: Ways to deal with large amount of columns;  (Tim Cross <theophilusx@gmail.com>)
Список pgsql-general
Thank you very much. Creating a function seems to be a good idea :)


------------------ Original message ------------------
From: "David G. Johnston";
Sendtime: Thursday, Aug 30, 2018 8:31 PM
To: "a"<372660931@qq.com>;
Cc: "pgsql-general";
Subject: Re: Ways to deal with large amount of columns;

On Thursday, August 30, 2018, a <372660931@qq.com> wrote:
Hi all:

I need to make a table contains projected monthly cashflow for multiple agents (10,000 around).

Therefore, the column number would be 1000+. 

I would need to perform simple aggregate function such as count, sum or average on each cashflow projected.

So if there is anyway of doing this? Will there be anything like define a macro in C that I can manipulate multiple columns by simple word that representing them.

Better to design a data model that doesn't have so many columns. Otherwise generating dynamic SQL via the for,at function and loops and such is your best bet.  Can be down in pl/pgsql or in your preferred programming language.  Psql variables can maybe be useful too.

David J.
 

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

Предыдущее
От: "a"
Дата:
Сообщение: Re: Ways to deal with large amount of columns;
Следующее
От: Ruiqiang Chen
Дата:
Сообщение: Re: searching a value in a variable/field in all tables in a schema