Adding fields on the fly

Started by Gail Zachariasover 22 years ago2 messagesgeneral
Jump to latest
#1Gail Zacharias
gz@clozure.com

I am investigating the possibility of using pgsql as the database in an application. I have some unusual requirements that I'd like to ask you all about. I apologize in advance if my terminology is a little "off", I'm not familiar with pgsql (yet).

My first requirement is that I need to be able to add new columns to any database table on the fly. By this I mean that I need this to happen interactively -- a user will drag some UI widget from here to there and boom! my application will request a new column to be added to a table, and wait for it to happen before giving visual feedback to the user. My questions are:

Is this even possible? Is ALTER TABLE supported?
If so, what performance characteristics can I expect? Compared to, say, inserting a record, can I expect this to be 10 times slower? 1000 times slower?
What does the performance depend on? Number of rows? Number of columns? Number of tables? anything else?

I'll send my other question in a separate message to keep the threads separate.

Thanks in advance,

Gail Zacharias

#2Peter Eisentraut
peter_e@gmx.net
In reply to: Gail Zacharias (#1)
Re: Adding fields on the fly

Gail Zacharias writes:

Is this even possible? Is ALTER TABLE supported?

Yes. (RTFM)

If so, what performance characteristics can I expect? Compared to, say,
inserting a record, can I expect this to be 10 times slower? 1000 times
slower? What does the performance depend on? Number of rows? Number of
columns? Number of tables? anything else?

Adding a column runs in constant time.

--
Peter Eisentraut peter_e@gmx.net