Skip site navigation (1) Skip section navigation (2)

Re: probelm with alter table add constraint......

From: roopabenzer <roopabenzer(at)gmail(dot)com>
To: pgsql-performance(at)postgresql(dot)org
Subject: Re: probelm with alter table add constraint......
Date: 2009-04-22 07:16:12
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-performance

Tom Lane-2 wrote:
> "Albe Laurenz" <laurenz(dot)albe(at)wien(dot)gv(dot)at> writes:
>> roopasatish wrote:
>>> I have an issue with the add foreign key constraint which 
>>> goes for waiting and locks other queries as well.
>>> ALTER TABLE ONLY holding_positions ADD CONSTRAINT 
>>> holding_positions_stock_id_fkey FOREIGN KEY (stock_id)
>>> REFERENCES stocks (stock_id) MATCH SIMPLE
>>> The holding_positions table has no data in it as yet.
>> Look in pg_catalog.pg_locks for a second transaction that
>> holds a lock on the table holding_positions.
> This statement also needs to get lock on the referenced table "stocks".
> An open transaction that's referenced either table will block it.
> 			regards, tom lane
> -- 
> Sent via pgsql-performance mailing list (pgsql-performance(at)postgresql(dot)org)
> To make changes to your subscription:

I can't lock the table 'stocks' as its used continuously by many users. Is
there a way to run the constraint in a background without affecting the
users using the database.

Thanks a lot in advance
View this message in context:
Sent from the PostgreSQL - performance mailing list archive at

In response to

pgsql-performance by date

Next:From: Stephen FrostDate: 2009-04-22 12:19:28
Subject: Re: performance for high-volume log insertion
Previous:From: James MansionDate: 2009-04-22 05:26:07
Subject: Re: performance for high-volume log insertion

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group