Search Postgresql Archives

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello

2010/6/28 Björn Lindqvist <bjourne@xxxxxxxxx>:
> 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@xxxxxxxxxxxxxx)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>

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



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux