Re: Slow update

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: Slow update
Дата
Msg-id 43255DA5.9030602@archonet.com
обсуждение исходный текст
Ответ на Slow update  (Hilary Forbes <hforbes@dmr.co.uk>)
Список pgsql-performance
Hilary Forbes wrote:
>
> I need to set the value of a field in table A to a value in table B depending on the existence of the record in table
B. So what I have done is 
>
> UPDATE tableA set a.val1=b.somefield FROM tableA a, tableB b WHERE a.key1=b.key1;

Check the EXPLAIN carefully, are you sure the tableA in "UPDATE" is the
same as that in your "FROM" clause. If so, why are you SETting a.val1?

If not, you've probably got an unconstrained join.
--
   Richard Huxton
   Archonet Ltd

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

Предыдущее
От: Manfred Koizar
Дата:
Сообщение: Re: LEFT JOIN optimization
Следующее
От: Dave Cramer
Дата:
Сообщение: Re: Prepared statement not using index