Re: add column with default value is very slow

From: hubert depesz lubaczewski <depesz(at)depesz(dot)com>
To: AI Rumman <rummandba(at)gmail(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: add column with default value is very slow
Date: 2012-09-11 13:44:25
Message-ID: 20120911134425.GA27828@depesz.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Tue, Sep 11, 2012 at 07:20:28PM +0600, AI Rumman wrote:
> I have a table as follows:
> I execued the query:
> ALTER TABLE entity ADD COLUMN owner_type char(1) NOT NULL default 'U';
>
> The db is stuck. The enity table has 2064740 records;

such alter table has to rewrite whole table. So it will take a while

> Watching locks:

output of this was perfectly unreadable, because your email client
wrapped lines at some random places.

In future - please put such dumps on some paste site, or just attach it
to mail, and not copy/paste them to body of message.

Best regards,

depesz

--
The best thing about modern society is how easy it is to avoid contact with it.
http://depesz.com/

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message AI Rumman 2012-09-11 13:55:24 Re: add column with default value is very slow
Previous Message Albe Laurenz 2012-09-11 13:41:04 Re: add column with default value is very slow