Is full-row updates slower than single-value updates

From: Björn Lindqvist <bjourne(at)gmail(dot)com>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Is full-row updates slower than single-value updates
Date: 2010-06-28 17:08:37
Message-ID: AANLkTikDZ97r22aZDmeqHoF7ST2nAR780JL3EHvVVo66@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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?

--
mvh Björn

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Steve Crawford 2010-06-28 17:17:40 Re: EDB editions
Previous Message Tom Lane 2010-06-28 16:43:06 Re: How to log query parameters instead of variables with log_min_duration_statement