Re: add column with default value is very slow

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: AI Rumman <rummandba(at)gmail(dot)com>
Cc: depesz(at)depesz(dot)com, pgsql-performance(at)postgresql(dot)org
Subject: Re: add column with default value is very slow
Date: 2012-09-11 14:07:04
Message-ID: 504F4588.7030900@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance


On 09/11/2012 09:55 AM, AI Rumman wrote:
> I added the excel file for locks data.
> I was surprised to see that while I was updating a single column value
> for all records in a tables, all indexes are locked by the server.

Any ALTER TABLE command locks the whole table in ACCESS EXCLUSIVE mode,
indexes included. See the description of ACCESS EXCLUSIVE lock at
<http://www.postgresql.org/docs/current/static/explicit-locking.html>

cheers

andrew

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2012-09-11 17:19:26 Re: Planner selects different execution plans depending on limit
Previous Message hubert depesz lubaczewski 2012-09-11 14:05:54 Re: add column with default value is very slow