Re: PL/pgSQL 2

Поиск
Список
Период
Сортировка
От Joel Jacobson
Тема Re: PL/pgSQL 2
Дата
Msg-id CAASwCXdZq5Hg2LS+Sc3kaeTcFXYysphLj2mmi4vQnBPk+32X4g@mail.gmail.com
обсуждение исходный текст
Ответ на Re: PL/pgSQL 2  (Heikki Linnakangas <hlinnakangas@vmware.com>)
Список pgsql-hackers
On Tue, Sep 2, 2014 at 6:31 PM, Heikki Linnakangas
<hlinnakangas@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.



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

Предыдущее
От: Marko Tiikkaja
Дата:
Сообщение: Re: PL/pgSQL 2
Следующее
От: Joel Jacobson
Дата:
Сообщение: Re: PL/pgSQL 2