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@astro.umass.edu
University of Massachusetts http://www.astro.umass.edu/~weinberg/
Amherst, MA 01003-4525