On Wed, Jan 19, 2005 at 09:35:15AM +0000, Clive Page wrote:
> I have a largish table (71 million rows) to which I needed to add a new
> integer column containing a unique identifier - a simple sequence seemed
> to be good enough. I discovered the CREATE SEQUENCE command which looked
> as if it would do the job, and did the following:
>
> ALTER TABLE intwfs ADD COLUMN id int ;
> CREATE SEQUENCE myseq;
> UPDATE intwfs SET id = nextval('myseq');
You're not doing anything unusual there. Do you have any deferred
constrints or foreign keys. I can't think of anything else that might
take memory during the transaction.
The pg_dump output of the schema of that table would clear this up
probably.
Hope this helps,
--
Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.