> The answer to that of course is that cross-table constraints (like
> REFERENCES clauses) must be disabled while loading the data, or the
> intermediate states where only some tables have been loaded are likely
> to fail. So we do need some kind of DISABLE CONSTRAINT mode to make
> this work. But it's silly that pg_dump has to go out of its way to
> create the indexes last --- if COPY has a performance problem there,
> we should be fixing COPY, not requiring pg_dump to contort itself.
> Why can't COPY recognize for itself that rebuilding the indexes after
> loading data is a better strategy than incremental index update?
> (The simplest implementation would restrict this to happen only if the
> table is empty when COPY starts, which'd be sufficient for pg_dump.)
COPY would have to check to see if the table is already empty. You can
COPY into a table that already has data.
-- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610)
853-3000+ If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill,
Pennsylvania19026