From: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
---|---|
To: | a <372660931(at)qq(dot)com> |
Cc: | pgsql-general <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Ways to deal with large amount of columns; |
Date: | 2018-08-30 12:31:17 |
Message-ID: | CAKFQuwZWTUDVCTKcTBwCapPZQ9gp20eLDtiPGz=V-x07Y5xWfw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Thursday, August 30, 2018, a <372660931(at)qq(dot)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.
From | Date | Subject | |
---|---|---|---|
Next Message | Andreas Kretschmer | 2018-08-30 13:03:54 | Re: Ways to deal with large amount of columns; |
Previous Message | Gunnlaugur Thor Briem | 2018-08-30 09:24:13 | Re: pg_upgrade fails saying function unaccent(text) doesn't exist |