Обсуждение: Mail getting through? Short varlena headers

Поиск
Список
Период
Сортировка

Mail getting through? Short varlena headers

От
Gregory Stark
Дата:
I sent two emails last night, one to -patches and one to -hackers. Neither
seems to have come through. Has anyone else seen them? I sent this email once
already too and it hasn't come through. I'm resending it from a different
account now.

On -patches I posted an updated patch that was functionally a noop but changed
the macro api to SETVARSIZE(). It also replaced the VARATT_SIZE and
VARATT_DATA macros with VARSIZE and VARDATA, changed inet to call detoast, and
changed arrays, inet, geometric data types and a handful of others to use
SET_VARSIZE instead of accessing a struct member directly.

On -hackers I reposted Tom's email where he proposed two sets of bitpatterns
with tradeoffs and also included an additional one that was the second of his
with the 2-byte cases removed.

In it I said that removing the 2-byte cases had no advantages but actually
since then I've thought of one. It makes the toaster code simpler since it can
just set a bit in the four-byte header just as it does now. It doesn't have to
worry about converting to a 2-byte header.

So I'm thinking of doing it for now at least. I still think paying 2 bytes on
virtually every datum is silly even if mathematically it's only 2% space
savings that's still a 2% performance penalty on sequential scans and it gains
us nothing except a few lines of code saved in tuptoaster.c.

Comments?

-- 
greg



Re: Mail getting through? Short varlena headers

От
Tom Lane
Дата:
Gregory Stark <gsstark@mit.edu> writes:
> In it I said that removing the 2-byte cases had no advantages but actually
> since then I've thought of one. It makes the toaster code simpler since it can
> just set a bit in the four-byte header just as it does now. It doesn't have to
> worry about converting to a 2-byte header.

Run that by me again?  A toast pointer datum ought to have a 1-byte
header, since its only twenty-something bytes long.
        regards, tom lane


Re: Mail getting through? Short varlena headers

От
Gregory Stark
Дата:
"Tom Lane" <tgl@sss.pgh.pa.us> writes:

> Gregory Stark <gsstark@mit.edu> writes:
>> In it I said that removing the 2-byte cases had no advantages but actually
>> since then I've thought of one. It makes the toaster code simpler since it can
>> just set a bit in the four-byte header just as it does now. It doesn't have to
>> worry about converting to a 2-byte header.
>
> Run that by me again?  A toast pointer datum ought to have a 1-byte
> header, since its only twenty-something bytes long.

I was referring to compressed inline data.

By not having inline compressed data be 2-byte headers it eliminates having to
check a lot of corner cases and reduces the changes in tuptoaster.c since it
means pg_lzcompress can return a normal 4-byte header and nobody has to
convert it to a 2-byte header.

So I am doing that for now. I suspect we'll never get around to reintroducing
2-byte headers, but we could if we wanted to. It would be a small change
everywhere else but an annoying bunch of fiddly changes in tuptoaster.c.

--  Gregory Stark EnterpriseDB          http://www.enterprisedb.com