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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





Tom Lane-2 wrote:
> 
> "Albe Laurenz" <laurenz.albe@xxxxxxxxxx> 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
>>> ON UPDATE NO ACTION ON DELETE NO ACTION;
>>> 
>>> 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@xxxxxxxxxxxxxx)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-performance
> 
> 


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
Roopa
-- 
View this message in context: http://www.nabble.com/probelm-with-alter-table-add-constraint......-tp22903334p23170924.html
Sent from the PostgreSQL - performance mailing list archive at Nabble.com.


-- 
Sent via pgsql-performance mailing list (pgsql-performance@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance

[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux