From: roopabenzer <roopabenzer@gmail.com>
To: pgsql-performance@postgresql.org
Subject: Re: probelm with alter table add constraint......
Date: Wed, 22 Apr 2009 00:16:12 -0700 (PDT)
Message-ID: <23170924.post@talk.nabble.com> (raw)
In-Reply-To: <27085.1239026040@sss.pgh.pa.us>
References: <5da3d2700904052354g61f02031x822322e9ee512ad9@mail.gmail.com>
<D960CB61B694CF459DCFB4B0128514C202FF6545@exadv11.host.magwien.gv.at>
<27085.1239026040@sss.pgh.pa.us>
Tom Lane-2 wrote:
>
> "Albe Laurenz" <laurenz.albe@wien.gv.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
>>> 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@postgresql.org)
> 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.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: roopabenzer@gmail.com
Subject: Re: probelm with alter table add constraint......
In-Reply-To: <23170924.post@talk.nabble.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox