> Christopher Kings-Lynne wrote:
> Another idea. Now that we have ALTER TABLE / ADD PRIMARY KEY - we should
> modify the pg_dump format to instead of doing this:
>
> CREATE TABLE food (
> a int4,
> PRIMARY KEY (a)
> );
>
> COPY FROM ...
>
> It should be like this:
>
> CREATE TABLE food (
> a int4
> );
>
> COPY FROM ...
>
> ALTER TABLE food ADD PRIMARY KEY (a);
>
> This will be a lot faster. The only reason (I believe) that it was not done
> like this previously is that it wasn't possible to recreate a PK in any
> other way without twiddling the catalogs.
Very good point. Added to TODO:
* Have pg_dump use ADD PRIMARY KEY after COPY, for performance
--
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, Pennsylvania 19026