Re: UPDATE FROM problem, multiple updates of same row don't seem to work - Mailing list pgsql-sql

From Bruno Wolff III
Subject Re: UPDATE FROM problem, multiple updates of same row don't seem to work
Date
Msg-id 20040812022715.GB22747@wolff.to
Whole thread Raw
In response to UPDATE FROM problem, multiple updates of same row don't seem to work  (David Stanaway <david@stanaway.net>)
List 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 by date:

Previous
From: Bruno Wolff III
Date:
Subject: Re: reply to setting
Next
From: "Philippe Lang"
Date:
Subject: Re: function expression in FROM may not refer to other relations of same query level