From: Richard van den Berg <richard.vandenberg@trust-factory.com>
To: Christopher Kings-Lynne <chriskl@familyhealth.com.au>
Cc: pgsql-performance@postgresql.org
Subject: Re: Foreign key slows down copy/insert
Date: Thu, 14 Apr 2005 16:26:30 +0200
Message-ID: <425E7D96.6020201@trust-factory.com> (raw)
In-Reply-To: <425E792B.4020500@familyhealth.com.au>
References: <425E6045.4060201@trust-factory.com>
<425E792B.4020500@familyhealth.com.au>
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
-------------------------------------------
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: richard.vandenberg@trust-factory.com, chriskl@familyhealth.com.au
Subject: Re: Foreign key slows down copy/insert
In-Reply-To: <425E7D96.6020201@trust-factory.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox