Wes wrote:
Is there a way to add a foreign key constraint without having to wait for it to check the consistency of all existing records? If a database is being reloaded (pg_dumpall then load), it really shouldn't be necessary to check the referential integrity - or at least I should be able to stipulate that I am accepting that risk.
You could create the fk-constraints _first_, then disable them, load the data, reindex, and reenable them afterwards. pg_dump/pg_restore can enable and disable fk-constraints before restoring the data, I believe. It does so by tweaking the system catalogs. The only problem I can see is that creating the fk-constraints might create some indices too. But maybe you can manually drop those indices afterwards - I don't know if the fk really _depends_ on the index, or if it creates it only for convenience. greetings, Florian Pflug