From: | Bruno Wolff III <bruno(at)wolff(dot)to> |
---|---|
To: | David Stanaway <david(at)stanaway(dot)net> |
Cc: | pgsql-sql <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: UPDATE FROM problem, multiple updates of same row don't seem to work |
Date: | 2004-08-12 02:27:15 |
Message-ID: | 20040812022715.GB22747@wolff.to |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
On Wed, Aug 11, 2004 at 20:50:28 -0500,
David Stanaway <david(at)stanaway(dot)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.
From | Date | Subject | |
---|---|---|---|
Next Message | Philippe Lang | 2004-08-12 07:35:01 | Re: function expression in FROM may not refer to other relations of same query level |
Previous Message | Bruno Wolff III | 2004-08-12 02:15:31 | Re: reply to setting |