Search Postgresql Archives

Re: Locking referenced table when creating and dropping tables with foreign key constraints

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

 



frank joerdens <fiskadoro@xxxxxxxxx> writes:
> It seems that whenever I create a new empty table with a foreign key
> constraint, the transaction will acquire an exclusive lock on the
> referenced table, locking out other writers (not sure if even readers
> as well), and I don't quite see why that is necessary

It involves an ALTER TABLE ADD TRIGGER command, which necessarily locks
out writers to avoid race conditions.  I think at the moment it may take
an exclusive lock and thereby lock out readers as well.  There has been
some talk of trying to reduce the lock strength needed for ALTER
operations, but you should not expect that it'll ever be possible to
do that without blocking writers.

			regards, tom lane

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux