From: Joe Conway <mail@joeconway.com>
To: pabloa98 <pabloa98@gmail.com>
To: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: how to add more than 1600 columns in a table?
Date: Wed, 24 Apr 2019 16:47:16 -0400
Message-ID: <1a69e85f-446b-99fa-d161-a647a79c0b69@joeconway.com> (raw)
In-Reply-To: <CAEjudX7ZtdVFAENPQUWVMe741N0me0Op24GHE4ibPdm--hJHvw@mail.gmail.com>
References: <CAEjudX7ZtdVFAENPQUWVMe741N0me0Op24GHE4ibPdm--hJHvw@mail.gmail.com>
On 4/24/19 4:17 PM, pabloa98 wrote:
> Sadly today we hit the 1600 columns limit of Postgresql 11.
>
> How could we add more columns?
>
> Note: Tables are OK. We truly have 2400 columns now. Each column
> represents a value in a matrix.
As everyone else has mentioned, your use case sounds like arrays are
appropriate. Note that PostgreSQL supports 2 dimensional (actually more
than 2d if you wanted) arrays which are essentially perfect for
representing a matrix.
If this works for your data model it will likely save a ton of storage
space and perform much better than alternatives.
FWIW, if you are needing to do matrix math, you might want to look into
PL/R (https://github.com/postgres-plr/plr) as it supports 2d arrays as
arguments which are converted directly into R matrices.
I don't know for sure but likely PL/Python could be used to process
matrices as well.
HTH,
Joe
--
Crunchy Data - http://crunchydata.com
PostgreSQL Support for Secure Enterprises
Consulting, Training, & Open Source Development
Attachments:
signature.asc (application/pgp-signature, 832B) download
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: mail@joeconway.com, pabloa98@gmail.com
Subject: Re: how to add more than 1600 columns in a table?
In-Reply-To: <1a69e85f-446b-99fa-d161-a647a79c0b69@joeconway.com>
References: <CAEjudX7ZtdVFAENPQUWVMe741N0me0Op24GHE4ibPdm--hJHvw@mail.gmail.com> <1a69e85f-446b-99fa-d161-a647a79c0b69@joeconway.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