From: Bruno Wolff III <bruno@wolff.to>
To: David Stanaway <david@stanaway.net>
Cc: pgsql-sql <pgsql-sql@postgresql.org>
Subject: Re: UPDATE FROM problem, multiple updates of same row don't seem to work
Date: Wed, 11 Aug 2004 21:27:15 -0500
Message-ID: <20040812022715.GB22747@wolff.to> (raw)
In-Reply-To: <FCEA9328-EC01-11D8-A0B2-0003930FDAB2@stanaway.net>
References: <1092082589.7197.3.camel@dmxnocws13.dialmex.net>
<20040811235241.GB19680@wolff.to>
<FCEA9328-EC01-11D8-A0B2-0003930FDAB2@stanaway.net>
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.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: bruno@wolff.to, david@stanaway.net
Subject: Re: UPDATE FROM problem, multiple updates of same row don't seem to work
In-Reply-To: <20040812022715.GB22747@wolff.to>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox