Re: [HACKERS] Avoiding io penalty when updating large objects

From: Alvaro Herrera <alvherre(at)surnet(dot)cl>
To: Mark Dilger <pgsql(at)markdilger(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org, pgsql-general(at)postgresql(dot)org
Subject: Re: [HACKERS] Avoiding io penalty when updating large objects
Date: 2005-06-29 02:53:17
Message-ID: 20050629025317.GC7196@surnet.cl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

On Tue, Jun 28, 2005 at 07:38:43PM -0700, Mark Dilger wrote:
> I would like to write a postgres extension type which represents a btree of
> data and allows me to access and modify elements within that logical btree.
> Assume the type is named btree_extension, and I have the table:
>
> CREATE TABLE example (
> a TEXT,
> b TEXT,
> c BTREE_EXTENSION,
> UNIQUE(a,b)
> );
>
> If, for a given row, the value of c is, say, approximately 2^30 bytes
> large, then I would expect it to be divided up into 8K chunks in an
> external table, and I should be able to fetch individual chunks of that
> object (by offset) rather than having to detoast the whole thing.

I don't think you can do this with the TOAST mechanism. The problem is
that there's no API which allows you to operate on only certain chunks
of data. You can do it with large objects though -- those you create
with lo_creat(). You can do lo_seek(), lo_read() and lo_write() as you
see fit. Of course, this allows you to change the LO by chunks.

--
Alvaro Herrera (<alvherre[a]surnet.cl>)
"No hay hombre que no aspire a la plenitud, es decir,
la suma de experiencias de que un hombre es capaz"

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2005-06-29 03:58:59 Re: [HACKERS] Avoiding io penalty when updating large objects
Previous Message Mark Dilger 2005-06-29 02:38:43 Avoiding io penalty when updating large objects

Browse pgsql-hackers by date

  From Date Subject
Next Message Satoshi Nagayasu 2005-06-29 03:21:03 Re: Open items
Previous Message Stephen Frost 2005-06-29 02:47:11 Re: Open items