Re: [RFC] indirect toast tuple support - Mailing list pgsql-hackers

From Greg Stark
Subject Re: [RFC] indirect toast tuple support
Date
Msg-id CAM-w4HNUKYJ-nOyhqinDQgXJsmvKGVmCmUZyJYrRShgY1yS89g@mail.gmail.com
Whole thread Raw
In response to [RFC] indirect toast tuple support  (Andres Freund <andres@2ndquadrant.com>)
List pgsql-hackers
On Sat, Feb 16, 2013 at 4:42 PM, Andres Freund <andres@2ndquadrant.com> wrote:
> I propose extending the EXTERNAL varlenas to be able to point to memory
> instead just to disk. It seem apt to use EXTERNAL for this as they
> aren't stored in the normal heap tuple but somewhere else.
> Unfortunately there is no backward-compatible flag space in
> varattrib_1b_e either to nicely denote this and we sure don't want to
> break on-disk compatibility for this. Thus I propose to distinguish
> on-disk and in-memory tuples via the varattrib_1b_e.va_len_1be.

The intention was to use va_len_1be to allow extensibility with
different external toast types. We were originally not going to have
it at all and just before committing we became concerned that we
wanted to avoid painting ourselves into a corner where we wouldn't be
able to come up with any new formats for external toast types. So we
added this one byte. i suggest thinking of it more as a "type" field
that happens to be the length of the toast pointer by convention than
an actual length header.

Just as an example I have at various times proposed a column
compression method that would store a dictionary of common values and
the toast pointer would be a pointer to this dictionary and an index
into it.

I have no problem using it for this case since it's using up only one
particular value for this field. As long as you don't want to use up
all the possible values for a single type of external pointer it seems
in line with the plan.


-- 
greg



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: FDW for PostgreSQL
Next
From: Greg Stark
Date:
Subject: Re: overlapping strncpy/memcpy errors via valgrind