Re: Alter definition of a column - Mailing list pgsql-general

From Martijn van Oosterhout
Subject Re: Alter definition of a column
Date
Msg-id 20070119141800.GB10356@svana.org
Whole thread Raw
In response to Re: Alter definition of a column  (af300wsm@gmail.com)
Responses Re: Alter definition of a column
List pgsql-general
On Thu, Jan 18, 2007 at 06:27:04AM -0800, af300wsm@gmail.com wrote:
> ksherlock@gmail.com wrote:
> > Using ALTER TABLE <table> ALTER <field> TYPE VARCHAR(<newsize>) to
> > change the size requires scanning the entire table.  For large tables,
> > this will be much slower than the pg_attribute query.  Both will get
> > the job done.
>
> Thanks.  Am I correct in assuming that this scanning of the entire
> table is done when I use the 'ALTER TABLE' command and not something I
> must do after it's done?

ALTER TABLE, to be correct, actually has to check the entire table to
make sure it's ok. By doing it directly you're basically telling the DB
it's OK.

For making a varchar column longer it's safe though, and the easiest way.

Have a ncie day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

Attachment

pgsql-general by date:

Previous
From: "Shoaib Mir"
Date:
Subject: Re: Who is Slony Master/Slave + general questions.
Next
From: Martijn van Oosterhout
Date:
Subject: Re: Clearing plans