Re: Two aesthetic bugs in the 1-byte packed varlena code

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Gregory Stark <stark(at)enterprisedb(dot)com>
Cc: "pgsql-patches" <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Two aesthetic bugs in the 1-byte packed varlena code
Date: 2007-06-12 19:12:37
Message-ID: 23376.1181675557@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Gregory Stark <stark(at)enterprisedb(dot)com> writes:
> "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:
>> After looking closer, I think there are worse problems here: the code is
>> still using VARSIZE/VARDATA etc, which it should not be because the
>> field could easily be in 1-byte-header form.

> Well that's ok because VARATT_IS_EXTENDED returns true for 1-byte forms so
> it'll detoast them first.

Ah, right.

> We could avoid the detoasting but given that it's
> expecting the chunks to be compressed anyways the memcpys of the smallest
> chunks probably don't matter much either way. I'm assuming it's like toast in
> that only the last chunk will be smaller than LOBLKSIZE anyways, right?

Well, it's like toast except that there can be unwritten "holes" in a LO.
Still, in normal cases you'd expect only the last partial page to be
potentially short enough for 1-B format, and even then only about 1/16th
of the time. OK, not worth changing then.

> There should never even be a null bitmap right? Maybe we should just
> elog(ERROR) if we find HeapTupleHasNulls(tuple) to be true at all.

That sounds like a good and cheap test. Will make it so.

regards, tom lane

In response to

Browse pgsql-patches by date

  From Date Subject
Next Message Josh Berkus 2007-06-12 19:49:06 Re: .conf File Organization
Previous Message Gregory Stark 2007-06-12 17:42:14 Re: Two aesthetic bugs in the 1-byte packed varlena code