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