adding foreign key constraint locks up table

Поиск
Список
Период
Сортировка
От kakarukeys
Тема adding foreign key constraint locks up table
Дата
Msg-id 75218696-61be-4730-89f6-dd6058fa9eda@a28g2000prb.googlegroups.com
обсуждение исходный текст
Ответы Re: adding foreign key constraint locks up table  (Gurjeet Singh <singh.gurjeet@gmail.com>)
Re: adding foreign key constraint locks up table  (Lew <noone@lewscanon.com>)
Re: adding foreign key constraint locks up table  (Florian Weimer <fweimer@bfk.de>)
Список pgsql-performance
I have a table "aaa" which is not very big. It has less than 10'000
rows. However read operations on this table is very frequent.

Whenever I try to create a new table "bbb" with foreign key pointing
to "aaa". The operation locks, and reading "aaa" is not possible. The
query also never seems to finish.

ALTER TABLE "bbb" ADD CONSTRAINT "topic_id_refs_id_3942a46c6ab2c0b4"
FOREIGN KEY ("topic_id") REFERENCES "aaa" ("id") DEFERRABLE INITIALLY
DEFERRED;

The current workaround is to create any new table at off-peak hours,
e.g. midnight after restarting the db.

I would like to know if there's any proper solution of this. Is this
an issue affecting all relational databases? My db is PostgreSQL 8.3.

В списке pgsql-performance по дате отправления:

Предыдущее
От: Scott Marlowe
Дата:
Сообщение: Re: How to turn autovacuum prevent wrap around run faster?
Следующее
От: Gurjeet Singh
Дата:
Сообщение: Re: adding foreign key constraint locks up table