Re: Adding foreign key constraints without integrity check?

Поиск
Список
Период
Сортировка
От Jan Wieck
Тема Re: Adding foreign key constraints without integrity check?
Дата
Msg-id 449D9E7E.2010009@Yahoo.com
обсуждение исходный текст
Ответ на Adding foreign key constraints without integrity check?  (Wes <wespvp@syntegra.com>)
Ответы Lock changes with 8.1 - what's the right lock?  (Wes <wespvp@syntegra.com>)
Список pgsql-general
On 6/18/2006 11:41 PM, 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.
>
> 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.

The original implementation when the feature was new was to restore the
foreign key constraints at the end of the dump with CREATE CONSTRAINT
TRIGGER, which does not check the existing data. pg_dump was changed to
use ALTER TABLE instead. Maybe it would be good to have the old
behaviour as an option?


Jan

--
#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#================================================== JanWieck@Yahoo.com #

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

Предыдущее
От: Tony Caduto
Дата:
Сообщение: Re: Form builder?
Следующее
От: "Matthew T. O'Connor"
Дата:
Сообщение: Re: auto-vacuum & Negative "anl" Values