Re: UPDATE FROM problem, multiple updates of same row don't seem to work

Поиск
Список
Период
Сортировка
От Bruno Wolff III
Тема Re: UPDATE FROM problem, multiple updates of same row don't seem to work
Дата
Msg-id 20040812022715.GB22747@wolff.to
обсуждение исходный текст
Ответ на UPDATE FROM problem, multiple updates of same row don't seem to work  (David Stanaway <david@stanaway.net>)
Список pgsql-sql
On Wed, Aug 11, 2004 at 20:50:28 -0500, David Stanaway <david@stanaway.net> wrote:
> 
> I had thought about that, but this is a simpler case of what I need to 
> do. The operations for each column in the update are dependent on the 
> current and new values of each row being merged.
> 
> Currently I am doing this with a cursor which is very slow! How about a 
> trigger on update? Or would this suffer the same behavior that I am 
> seeing with UPDATE FROM with a 1-many join?

There is a good chance that triggers would be faster since tablea seems
to reallly be a materialized view of an aggregate over tableb and doing
a delta calculation when a row changes is going to be faster than recalculating
the aggregate from scratch.

You won't have the same problem if you use a trigger as when you were
trying to calculate an aggregate using UPDATE.


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

Предыдущее
От: Bruno Wolff III
Дата:
Сообщение: Re: reply to setting
Следующее
От: "Philippe Lang"
Дата:
Сообщение: Re: function expression in FROM may not refer to other relations of same query level