Re: Foreign key slows down copy/insert

Поиск
Список
Период
Сортировка
От Richard van den Berg
Тема Re: Foreign key slows down copy/insert
Дата
Msg-id 425E7D96.6020201@trust-factory.com
обсуждение исходный текст
Ответ на Re: Foreign key slows down copy/insert  (Christopher Kings-Lynne <chriskl@familyhealth.com.au>)
Ответы Re: Foreign key slows down copy/insert
Re: Foreign key slows down copy/insert
Список pgsql-performance
Hello Chris,

Thanks for your answers.

Christopher Kings-Lynne wrote:
> Deferring makes no difference to FK checking speed...

But why then is the speed acceptable if I copy and then manually add the
FK? Is the check done by the FK so much different from when it is done
automatically using an active deffered FK?

> Well, that's what people do - even pg_dump will restore data and add the
> foreign key afterward...

If I have to go this route, is there a way of automatically dropping and
re-adding FKs? I can probably query pg_constraints and drop the
appropriate ones, but how do I re-add them after the copy/insert?

Sincerely,

--
Richard van den Berg, CISSP
-------------------------------------------
Trust Factory B.V. |     www.dna-portal.net
Bazarstraat 44a    |  www.trust-factory.com
2518AK The Hague   |  Phone: +31 70 3620684
The Netherlands    |  Fax  : +31 70 3603009
-------------------------------------------

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

Предыдущее
От: Dawid Kuroczko
Дата:
Сообщение: Re: speed of querry?
Следующее
От: Christopher Kings-Lynne
Дата:
Сообщение: Re: Foreign key slows down copy/insert