Re: Foreign key wierdness

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Foreign key wierdness
Дата
Msg-id 3113.1043076458@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Foreign key wierdness  ("Dave Page" <dpage@vale-housing.co.uk>)
Список pgsql-hackers
"Dave Page" <dpage@vale-housing.co.uk> writes:
> A pgAdmin user has noticed that Foreign Keys take significantly longer
> to create when migrating a database in pgAdmin in v1.4.12 than in
> v1.4.2.

The only reason ADD FOREIGN KEY would take a long time is if
(a) it has to wait awhile to get exclusive lock on either   the referencing or referenced table; and/or
(b) it takes a long time to verify that the existing entries   in the referencing table all have matches in the
referencedtable.   (that's the behind-the-scenes query you see)
 

I'm betting that the table was busy, or there was a lot more data
present in the one case, or you hadn't ever vacuumed/analyzed one or
both tables and so a bad plan was chosen for the verification query.
The schema reference is definitely not the issue.
        regards, tom lane


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

Предыдущее
От: Adrian 'Dagurashibanipal' von Bidder
Дата:
Сообщение: Re: Options for growth
Следующее
От: "Dave Page"
Дата:
Сообщение: Re: Foreign key wierdness