Received: from makus.postgresql.org ([98.129.198.125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TBR7c-0001kS-43 for pgsql-performance@postgresql.org; Tue, 11 Sep 2012 14:07:24 +0000 Received: from relay3-d.mail.gandi.net ([217.70.183.195]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TBR7a-0000To-4y for pgsql-performance@postgresql.org; Tue, 11 Sep 2012 14:07:23 +0000 X-Originating-IP: 217.70.178.150 Received: from mfilter22-d.gandi.net (mfilter22-d.gandi.net [217.70.178.150]) by relay3-d.mail.gandi.net (Postfix) with ESMTP id 76001A80AD; Tue, 11 Sep 2012 16:07:08 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at mfilter22-d.gandi.net Received: from relay3-d.mail.gandi.net ([217.70.183.195]) by mfilter22-d.gandi.net (mfilter22-d.gandi.net [10.0.15.180]) (amavisd-new, port 10024) with ESMTP id f8txj883yq99; Tue, 11 Sep 2012 16:07:07 +0200 (CEST) X-Originating-IP: 98.27.54.176 Received: from [192.168.10.146] (cpe-098-027-054-176.nc.res.rr.com [98.27.54.176]) (Authenticated sender: adsend@dunslane.net) by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id 9E1D2A807C; Tue, 11 Sep 2012 16:07:06 +0200 (CEST) Message-ID: <504F4588.7030900@dunslane.net> Date: Tue, 11 Sep 2012 10:07:04 -0400 From: Andrew Dunstan User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120827 Thunderbird/15.0 MIME-Version: 1.0 To: AI Rumman CC: depesz@depesz.com, pgsql-performance@postgresql.org Subject: Re: add column with default value is very slow References: <20120911134425.GA27828@depesz.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.6 (--) X-Archive-Number: 201209/44 X-Sequence-Number: 47790 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 cheers andrew