pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andreas Kretschmer <andreas@a-kretschmer.de>
To: pgsql-general@lists.postgresql.org
Subject: Re: Ways to deal with large amount of columns;
Date: Thu, 30 Aug 2018 15:27:51 +0200
Message-ID: <eea42068-5137-73d7-e86b-ab02f1b95bb8@a-kretschmer.de> (raw)
In-Reply-To: <5B87EDDF.60602@sibvisions.com>
References: <tencent_74B211A80785C27C5C3C58D8@qq.com>
	<5B87EDDF.60602@sibvisions.com>



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
>          AGENT = 'Agent'
>          and MONTH between values;
>
> It might be a little more work to create a GUI for that (or map this model to
> the existing GUI) but it is much simpler to maintain and work with.

agree. it is also possible to use partitioning.

Regards, Andreas

-- 
2ndQuadrant - The PostgreSQL Support Company.
www.2ndQuadrant.com





view thread (11+ messages)  latest in thread

Message-ID: <eea42068-5137-73d7-e86b-ab02f1b95bb8@a-kretschmer.de>
Permalink:  ../eea42068-5137-73d7-e86b-ab02f1b95bb8@a-kretschmer.de/
Also on:    postgresql.org/message-id/eea42068-5137-73d7-e86b-ab02f1b95bb8@a-kretschmer.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: andreas@a-kretschmer.de
  Subject: Re: Ways to deal with large amount of columns;
  In-Reply-To: <eea42068-5137-73d7-e86b-ab02f1b95bb8@a-kretschmer.de>
  References: <tencent_74B211A80785C27C5C3C58D8@qq.com> <5B87EDDF.60602@sibvisions.com> <eea42068-5137-73d7-e86b-ab02f1b95bb8@a-kretschmer.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox