Re: [GENEAL] dynamically changing table

From: A B <gentosaker(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: [GENEAL] dynamically changing table
Date: 2009-03-30 17:17:23
Message-ID: dbbf25900903301017s6b9dfab1ufeebce4674713782@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> Well, not as such. Except that deleting a column doesn't really delete
> it, it hides it, so it never really goes away. So the number of
> "columns" in your table will only go up and eventually you're going to
> reach the point (around 1600 IIRC, probably earlier) where it will
> simply stop working.

Oh, that would be a not very plesant surprise.

> If this is just for development where the actual space/columns used is
> just temporary, your trick might work. Otherwise I'd suggest
> normalising so the columns to become rows in another table. But you're
> going to have to be more specific as to what you're trying to do if you
> want proper answers.

Well, I want to store information about certain objects. Some columns
will be fixed from the start, other columns will be added or removed
(like when someone comes up with a brilliant idea of adding new
information about the object, or removing something that is not
needed)
It's a little hard to specify what operations will be performed on the
data, but mostly it will be "fetch all data for object number X", or
"increase integer field nr 4 by 1 for object number X".
And then I'll also have the operations: "add a new field with default
value 0" and "remove integer field number 2"

The fixed columns could be placed in a special table, as suggested above.

> Or perhaps an array of integers?
That sounds to be a better way. I'll start reading about arrays. I
have not used them earlier so I wasn't thinking about them.
How would you handle fields of other datatype than integers? Have an
array for timestamps, one for texts, one for varchar(50), one for
floatingpoint numbers, etc.?

In response to

Browse pgsql-general by date

  From Date Subject
Next Message David Fetter 2009-03-30 18:04:06 Re: [GENEAL] dynamically changing table
Previous Message Emanuel Calvo Franco 2009-03-30 16:32:13 Re: running two clusters on one machine