Re: adding foreign key constraint locks up table

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: kakarukeys <kakarukeys(at)gmail(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: adding foreign key constraint locks up table
Date: 2011-01-09 03:34:11
Message-ID: AANLkTik8QyPfHnmALKtm4WGtTb7tDqzO4BTGYE475UHW@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Wed, Jan 5, 2011 at 2:09 AM, kakarukeys <kakarukeys(at)gmail(dot)com> wrote:
> As requested, here are some output of the investigative queries, run
> when the problem occurred. I could see some locks there, but I don't
> know why the alter table add constraint takes so long of time.

It's pretty clear from the output you posted that it's waiting for a
lock, but you didn't include the full contents of pg_stat_activity and
pg_locks, so we can't see who has the lock it's waiting for. Tom's
guess upthread is a good bet, though.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Dimitri Fontaine 2011-01-09 13:58:14 Re: MySQL HandlerSocket - Is this possible in PG?
Previous Message Greg Smith 2011-01-08 01:59:01 pgbench to the MAXINT