Altering a column type - Most efficient way

From: Ow Mun Heng <Ow(dot)Mun(dot)Heng(at)wdc(dot)com>
To: Pgsql performance <pgsql-performance(at)postgresql(dot)org>
Subject: Altering a column type - Most efficient way
Date: 2008-07-10 07:53:00
Message-ID: 1215676380.15319.2.camel@neuromancer.home.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Is there any quick hacks to do this quickly? There's around
20-30million
rows of data.

I want to change a column type from varchar(4) to varchar()

table size is ~10-15GB (and another 10-15G for indexes)

What would be the preferrred way of doing it? SHould I be dropping the
indexes 1st to make things faster? Would it matter?

The punch line is that since the databases are connected via slony, this
makes it even harder to pull it off. My last try got the DDL change
completed in like 3 hours (smallest table of the bunch) and it hung
everything.

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Mario Weilguni 2008-07-10 08:36:10 Re: Altering a column type - Most efficient way
Previous Message Vivek Khera 2008-07-09 15:59:31 Re: max fsm pages question