Search Postgresql Archives

Re: alter table is taking a long time

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

 



On Sat, Nov 07, 2009 at 10:48:14AM +0200, Johan Nel wrote:
> update pg_attribute set attlen = 4 + <newlength>
> where attname = 'yourcolumnname'
> 
> That will take only a couple of milliseconds to do.

It will also update *every* column with that name.  Something involving
the "attrelid" would be much safer.  I'd use something like:

  update pg_attribute set attlen = 4 + <newlength>
  where attrelid = regclass 'your table name'
    and attname  = 'yourcolumnname';

-- 
  Sam  http://samason.me.uk/

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[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