On Tue, Sep 2, 2014 at 6:31 PM, Heikki Linnakangas
<hlinnakan...@vmware.com> wrote:
> I don't think most applications are like that. See Kevin's comments about
> doing things in a set-oriented way instead of row-by-row. I know I've
> changed several procedures from the row-oriented style, looping over rows
> with a FOR loop, updating each one individually, to set-oriented style with
> a single UPDATE for a bunch of rows. It makes for more concise code, and
> performs better. I'm sure there are counter-examples, and I've also written
> many UPDATE statements that are expected to update exactly one row, but I
> find an ASSERT would be adequate for that.

I'm *not* doing FOR-loops with UPDATE of single rows. I typically have
functions which have an input variable, which maps to a primary key in
a table, and the UPDATE is made on that single row. This is a
simplificaiton, but the main point is that the typical use case is
*not* FOR-loops.


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to