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