Re: ALTER TABLE <name> ADD COLUMN Hangs

From: "Ross J(dot) Reedstrom" <reedstrm(at)rice(dot)edu>
To: pgsql-admin(at)postgresql(dot)org
Subject: Re: ALTER TABLE <name> ADD COLUMN Hangs
Date: 2010-04-22 03:43:17
Message-ID: 20100422034317.GA3902@rice.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Thu, Apr 22, 2010 at 11:47:34AM +0930, Samuel Stearns wrote:
> Howdy,
>
> I'm running in an 8.3.3 environment. What could cause, or how can I diagnose, why an 'ALTER TABLE <name> ADD COLUMN' statement runs for hours eventually locking users out and requiring to be killed in the end?
>

ALTER TABLE commands require an exclusive lock on the table. I'm
guessing you've got a long-running transaction ahead of the ALTER TABLE.
take a look at pg_stat_activity, in particular 'waiting' and pg_locks.

Ross
--
Ross Reedstrom, Ph.D. reedstrm(at)rice(dot)edu
Systems Engineer & Admin, Research Scientist phone: 713-348-6166
The Connexions Project http://cnx.org fax: 713-348-3665
Rice University MS-375, Houston, TX 77005
GPG Key fingerprint = F023 82C8 9B0E 2CC6 0D8E F888 D3AE 810E 88F0 BEDE

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Scott Marlowe 2010-04-22 06:44:27 Re: ALTER TABLE <name> ADD COLUMN Hangs
Previous Message Samuel Stearns 2010-04-22 02:17:34 ALTER TABLE <name> ADD COLUMN Hangs