Re: Alter definition of a column

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: af300wsm(at)gmail(dot)com
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Alter definition of a column
Date: 2007-01-19 14:18:00
Message-ID: 20070119141800.GB10356@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Jan 18, 2007 at 06:27:04AM -0800, af300wsm(at)gmail(dot)com wrote:
> ksherlock(at)gmail(dot)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(at)svana(dot)org> http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Martijn van Oosterhout 2007-01-19 14:33:12 Re: Clearing plans
Previous Message Benedict Faria 2007-01-19 13:02:12 Help : Microsoft SQL Server equivalents in PostGreSQL