Re: Ways to deal with large amount of columns;

2018-08-31 Thread Brent Wood
You need to normalise your data model... the basic dataset you describe will probably fit in one table with three columns, but that might be simplistic... All your aggregate queries are pretty basic SQL statements, which could be represented as views or made simpler to invoke by turning them int

Re: Ways to deal with large amount of columns;

2018-08-31 Thread Ben Madin
Hi - this is a spreadsheet model, not a database model, and could be modelled with three columns. The aggregate functions are an analytic issue, not a data issue. cheers Ben On 30 August 2018 at 17:13, a <372660...@qq.com> wrote: > Hi all: > > I need to make a table contains projected monthly

Re: Ways to deal with large amount of columns;

2018-08-30 Thread Tim Cross
31 PM > *To:* "a"<372660...@qq.com>; > *Cc:* "pgsql-general"; > *Subject:* Re: Ways to deal with large amount of columns; > > On Thursday, August 30, 2018, a <372660...@qq.com> wrote: > >> Hi all: >> >> I need to make a table contains

Re: Ways to deal with large amount of columns;

2018-08-30 Thread a
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"<372660...@qq.com>; Cc: "pgsql-general"; Subject: R

Re: Ways to deal with large amount of columns;

2018-08-30 Thread a
Sendtime: Friday, Aug 31, 2018 6:24 AM To: "a"<372660...@qq.com>; Cc: "pgsql-general"; Subject: Re: Ways to deal with large amount of columns; a <372660...@qq.com> writes: > Hi all: > > > I need to make a table contains projected monthly cashflow f

Re: Ways to deal with large amount of columns;

2018-08-30 Thread Tim Cross
a <372660...@qq.com> writes: > 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+. > > Not sure your data model is correct. Typically, with something like this, increasing the number

Re: Ways to deal with large amount of columns;

2018-08-30 Thread Andreas Kretschmer
Am 30.08.2018 um 15:15 schrieb Robert Zenz: As David said, you'd be better off having a table that looks like this (in terms of columns): * MONTH * AGENT * CASHFLOW So your query to get the sum of a single agent would be looking like: select sum(CHASFLOW) where

Re: Ways to deal with large amount of columns;

2018-08-30 Thread Robert Zenz
As David said, you'd be better off having a table that looks like this (in terms of columns): * MONTH * AGENT * CASHFLOW So your query to get the sum of a single agent would be looking like: select sum(CHASFLOW) where AGENT = 'Agent' and MONTH between values;

Re: Ways to deal with large amount of columns;

2018-08-30 Thread Andreas Kretschmer
Am 30.08.2018 um 11:13 schrieb a: Therefore, the column number would be 1000+. just as a additional note: there is a limit, a table can contains not more than 250-100 columns, dependsing on column types. https://wiki.postgresql.org/wiki/FAQ Regards, Andreas -- 2ndQuadrant - The PostgreSQ

Re: Ways to deal with large amount of columns;

2018-08-30 Thread David G. Johnston
On Thursday, August 30, 2018, a <372660...@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 > a