Re: [GENEAL] dynamically changing table - Mailing list pgsql-general

From ries van Twisk
Subject Re: [GENEAL] dynamically changing table
Date
Msg-id 372132E8-2526-4921-B7ED-93BE71B4A3D7@rvt.dds.nl
Whole thread Raw
In response to [GENEAL] dynamically changing table  (A B <gentosaker@gmail.com>)
List pgsql-general
Without knowing to much currently..

can you create one table with enough columns?

Then create a view to query the table and 'reflect' the changes and
correct column names.
Using rule you could also even simulate the update to the view and
update to the correct columns.

This so that you don't have to drop/create columns over and over again.

I hope I made myself clear...

Ries




On Mar 30, 2009, at 10:39 AM, A B wrote:

> Hi,
> In the next project I'm going to have a number of colums in my tables,
> but I don't know how many, they change. They all use integers as
> datatype though.. One day, I get 2 new columns, a week later I loose
> one column, and so on in a random pattern.
>
> I will most likely have a few million rows of data so I just wonder if
> there are any problems with running
> alter table x add column .....
> or
> alter table x drop column .....
>
> Adding a column, will it place data "far away" on the  disc so that
> select * from x where id=y will result in not quite optimal
> performance since it has to fetch columns from a lot of different
> places?
> Will deleting a column result in a lot of empty space that will anoy
> me later on?
>
> Are there any other clever solutions of this problem?
>
> --
> Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general






pgsql-general by date:

Previous
From: Emanuel Calvo Franco
Date:
Subject: Re: [GENEAL] dynamically changing table
Next
From: Martijn van Oosterhout
Date:
Subject: Re: [GENEAL] dynamically changing table