Search Postgresql Archives

Re: Add columns

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



P G <pgress5@xxxxxxxxx> writes:
> I see that one can add a new column to an existing
> table.  The documentation was not clear on how
> efficient this operation would be.  
> Does PostgreSQL make a copy of the entire table when
> adding a new column?  Or does it simply use extra
> space in the data blocks to add the new column?

If the new column has no default expression (ie, default null) then
adding a column doesn't touch the table at all, only some catalog
entries.

Inserting data into the column is expensive, of course, since you
have to update every row in the table to put it there.  This is
not different from any other UPDATE operation.

			regards, tom lane


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux