How to efficiently update many records at once

Поиск
Список
Период
Сортировка
От Martin Weinberg
Тема How to efficiently update many records at once
Дата
Msg-id 199911182007.PAA18109@osprey.astro.umass.edu
обсуждение исходный текст
Ответы Re: [GENERAL] How to efficiently update many records at once  (Beth Strohmayer <strohmayer@itd.nrl.navy.mil>)
Список pgsql-general
I have two tables with different information indexed by a unique key.
I want to update the contents of one table if an entry exists in
a second table.

Some playing with explain suggests that the optimum strategy using
UPDATE is:

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

This *does work* but can double the size of the database (until
the next vacuum).  Is there an efficient way to do this in situ?

The problem is that my database is 100GB and only have 132GB
of space.

Sorry if this is a SQL/DBMS FAQ . . . I couldn't find any guidance
in the books and newsgroups.

--Martin

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

Martin Weinberg                      Phone: (413) 545-3821
Dept. of Physics and Astronomy       FAX:   (413) 545-2117/0648
530 Graduate Research Tower
University of Massachusetts
Amherst, MA  01003-4525



В списке pgsql-general по дате отправления:

Предыдущее
От: Miguel Montes
Дата:
Сообщение: Problems with datetime
Следующее
От: Faqir Abu Tahir
Дата:
Сообщение: