pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tim Cross <theophilusx@gmail.com>
To: a <372660931@qq.com>
Cc: pgsql-general <pgsql-general@postgresql.org>
Subject: Re: Ways to deal with large amount of columns;
Date: Fri, 31 Aug 2018 08:24:28 +1000
Message-ID: <87a7p3ijc3.fsf@gmail.com> (raw)
In-Reply-To: <tencent_74B211A80785C27C5C3C58D8@qq.com>
References: <tencent_74B211A80785C27C5C3C58D8@qq.com>


a <372660931@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 of agents would result in tables with more
rows rather than more columns. Tables with large numbers of columns is
often a 'code smell' and indicates the underlying data model needs to be
reviewed. Designs which result in new columns being required because you
are adding new data sources is almost certainly an indication of the
need to review the data model.

Postgres (and many other databases) have lots of functionality to help
deal with tables that have large numbers of rows, but working with
tables that have large numbers of columns has less functionality and
options.

While it is very tempting to create a table and then start coding, you
will almost always get a much better result and simpler code if you
spend some initial time to really analyse your domain, understand the
data elements and how they relate to each other, map them out into a
data model and then start development. Have a look at
https://en.wikipedia.org/wiki/Database_normalization for some background
on the normal forms and why they are useful.

HTH

Tim



-- 
Tim Cross




view thread (11+ messages)  latest in thread

Message-ID: <87a7p3ijc3.fsf@gmail.com>
Permalink:  ../87a7p3ijc3.fsf@gmail.com/
Also on:    postgresql.org/message-id/87a7p3ijc3.fsf@gmail.com

 · 

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: theophilusx@gmail.com, 372660931@qq.com
  Subject: Re: Ways to deal with large amount of columns;
  In-Reply-To: <87a7p3ijc3.fsf@gmail.com>
  References: <tencent_74B211A80785C27C5C3C58D8@qq.com> <87a7p3ijc3.fsf@gmail.com>

* 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