Re: Patch to ALTER TABLE docs for 7.2.1 - Mailing list pgsql-patches

From Bruce Momjian
Subject Re: Patch to ALTER TABLE docs for 7.2.1
Date
Msg-id 200202180200.g1I204X02955@candle.pha.pa.us
Whole thread Raw
In response to Re: Patch to ALTER TABLE docs for 7.2.1  ("Christopher Kings-Lynne" <chriskl@familyhealth.com.au>)
Responses Re: Patch to ALTER TABLE docs for 7.2.1  (Neil Conway <nconway@klamath.dyndns.org>)
List pgsql-patches
> 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

pgsql-patches by date:

Previous
From: "Christopher Kings-Lynne"
Date:
Subject: Re: Patch to ALTER TABLE docs for 7.2.1
Next
From: Neil Conway
Date:
Subject: Re: Patch to ALTER TABLE docs for 7.2.1