Adding foreign key constraints without integrity check?

From: Wes <wespvp(at)syntegra(dot)com>
To: pgsql general <pgsql-general(at)postgresql(dot)org>
Subject: Adding foreign key constraints without integrity check?
Date: 2006-06-19 03:41:04
Message-ID: C0BB8700.2875D%wespvp@syntegra.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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.

My database reload is currently taking about 6 hours to load the data, 42
hours to reindex, and about another 40 hours or so to check the foreign key
constraints (about 1.2 billion rows). That's a very long time to be out of
commission. I'd really like to eliminate that second 40 hours so I can get
it down to a normal weekend.

Wes

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Qingqing Zhou 2006-06-19 03:47:34 Re: How to optimize PostgreSQL database size
Previous Message Tom Lane 2006-06-19 03:13:11 Re: Out of memory error in 8.1.0 Win32