Bulk update of large database

From: Martin Weinberg <weinberg(at)osprey(dot)astro(dot)umass(dot)edu>
To: pgsql-hackers(at)postgreSQL(dot)org
Cc: weinberg(at)osprey(dot)astro(dot)umass(dot)edu
Subject: Bulk update of large database
Date: 1999-11-20 16:04:23
Message-ID: 199911201604.LAA25365@osprey.astro.umass.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I have two tables of roughly 200,000,000 records and want
to update one column in one of the tables according to
values in the second table using a unique key.

For example:

update table1 set x=1 from table2 where
exists (select * from table2 table1.key=table2.key);

(or using an IN clause or using a straight join but EXPLAIN tells me
that the latter is much slower).

This does work but appends the updates (until the next vacuum).
For a 100GB database, this is too large of a storage overhead.
Is there another good way? I've searched the newsgroups, docs and
books without a clue . . .

Thanks much,

--Martin

===========================================================================

Martin Weinberg Phone: (413) 545-3821
Dept. of Physics and Astronomy FAX: (413) 545-2117/0648
530 Graduate Research Tower weinberg(at)astro(dot)umass(dot)edu
University of Massachusetts http://www.astro.umass.edu/~weinberg/
Amherst, MA 01003-4525

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrij Korud 1999-11-20 17:25:42 C++ and SPI
Previous Message C.S.Park 1999-11-20 13:26:16 [q] can I simply remove pg_log file?