Re: When updating row that has TOAST column, is the TOAST column also reinserted ? Or just the oid to the value?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>
Cc: "'Dorian Hoxha *EXTERN*'" <dorian(dot)hoxha(at)gmail(dot)com>, PostgreSql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: When updating row that has TOAST column, is the TOAST column also reinserted ? Or just the oid to the value?
Date: 2016-12-13 15:25:10
Message-ID: 31355.1481642710@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at> writes:
> Dorian Hoxha wrote:
>> When updating row that has TOAST column, is the TOAST column also inserted ? Or just the oid?

> The TOAST table will remain unchanged by the UPDATE; you can see that with the
> "pageinspect" contrib module:

You can also read the documentation ;-). About halfway down this page:

https://www.postgresql.org/docs/current/static/storage-toast.html

it says:

During an UPDATE operation, values of unchanged fields are normally
preserved as-is; so an UPDATE of a row with out-of-line values incurs no
TOAST costs if none of the out-of-line values change.

I don't remember offhand what corner cases might exist to prompt the
weasel wording "normally". Maybe that just reflects the possibility
that one of the newly updated values would need toasting.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2016-12-13 15:31:49 Re: is this a known bug in 9.6?
Previous Message Chris Travers 2016-12-13 14:44:49 Re: Appending to multidimentional array.