Re: Is full-row updates slower than single-value updates - Mailing list pgsql-general

From Tom Lane
Subject Re: Is full-row updates slower than single-value updates
Date
Msg-id 28217.1278025271@sss.pgh.pa.us
Whole thread Raw
In response to Re: Is full-row updates slower than single-value updates  (Björn Lindqvist <bjourne@gmail.com>)
List pgsql-general
=?ISO-8859-1?Q?Bj=F6rn_Lindqvist?= <bjourne@gmail.com> writes:
> Den 28 juni 2010 20.22 skrev Tom Lane <tgl@sss.pgh.pa.us>:
>> But assigning a new value to a column costs something, even if it
>> happens to be equal to the previous value.

> But do I really need to worry about the cost of casting strings to
> ints and other such parsing operations?

Integers?  Maybe not.  Timestamps?  Probably you ought to think about
it.  Strings long enough to need toasting?  Definitely.

> No column in the table is a toast column, although there are a few
> string columns with quite long urls. If they are indexed, does
> updating them with the same data trigger index updates?

It shouldn't ordinarily, but if the data is long enough to get toasted
then updates are going to happen anyway, both in the toast table and
the main table.

The long and the short of it here is that being lazy is going to cost
you eventually.  Maybe it's all right in a single small application
where you can be confident about what sort of data will be stored, but
an allegedly general-purpose ORM should *not* be making that sort of
assumption.

            regards, tom lane

pgsql-general by date:

Previous
From: John R Pierce
Date:
Subject: Re: problems with encoding and accent letters
Next
From: Dennis Gearon
Date:
Subject: different language indexes