Re: Storing images as BYTEA or large objects

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Adam Rich" <adam(dot)r(at)sbcglobal(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Storing images as BYTEA or large objects
Date: 2008-02-13 04:34:56
Message-ID: 1543.1202877296@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Adam Rich" <adam(dot)r(at)sbcglobal(dot)net> writes:
>>> I have two options for storing this data: As BYTEA or as large objects.

> Is it true that if you update a row containing a large BYTEA value, (even if
> you're not updating the BYTEA field itself, just another field), it requires
> the entire BYTEA value to be copied to a new row (because of MVCC) ? Or is
> this not true because of TOAST?

It is not true. As long as you don't change the toasted value, it
contributes nothing much to the cost of updating the row. All that
has to be copied is a 20-byte pointer structure.

However, if you *do* change the toasted value, it is always updated as a
unit. So if you have use for writing into portions of a large value,
large objects are what you want.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ken Johanson 2008-02-13 05:06:22 Re: SELECT CAST(123 AS char) -> 1
Previous Message Dean Gibson (DB Administrator) 2008-02-13 04:34:26 Re: SELECT CAST(123 AS char) -> 1