Re: Is full-row updates slower than single-value updates

Поиск
Список
Период
Сортировка
От Pavel Stehule
Тема Re: Is full-row updates slower than single-value updates
Дата
Msg-id AANLkTile5YXjDC5zVaG8NMUk_7dD2gvI2ZHYZGC9aMqb@mail.gmail.com
обсуждение исходный текст
Ответ на Is full-row updates slower than single-value updates  (Björn Lindqvist <bjourne@gmail.com>)
Ответы Re: Is full-row updates slower than single-value updates  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
Hello

2010/6/28 Björn Lindqvist <bjourne@gmail.com>:
> Hello everyone,
>
> My question is like the subject, is it much slower to update all
> columns values than just a single column? Generated update queries
> from ORM:s generally have the following format:
>
> update foo set a = 1, b = 2, c = 3, .... where id = 1234;
>
> So each column is touched which, I suspect, is much slower than just
> updating a single column because more indexes has to be rebuilt and so
> on. EXPLAIN ANALYZE does not give any hints and claims that both
> queries are equally fast. Maybe someone can guide me to documentation
> which explains how to estimate how costly row-level updates are?
>

it depends. Pg create a new version of complete row for every update,
so isn't important if you update one or all columns. But there are
exception - TOAST columns. If you update any TOAST column, then UPDATE
is significally slower, so - if you don't need to update these
columns, then don't do it.

Regards

Pavel

> --
> mvh Björn
>
> --
> Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>

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

Предыдущее
От: Konstantin Izmailov
Дата:
Сообщение: Re: PQprepare in PostgreSQL 7.4 (lack of SAVEPOINTs)
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Is full-row updates slower than single-value updates