Re: Plan for compressed varlena headers

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Plan for compressed varlena headers
Дата
Msg-id 25905.1171472637@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Plan for compressed varlena headers  (Gregory Stark <stark@enterprisedb.com>)
Ответы Re: Plan for compressed varlena headers  (Gregory Stark <stark@enterprisedb.com>)
Список pgsql-hackers
Gregory Stark <stark@enterprisedb.com> writes:
> 1) Replace the VARATT_SIZEP macro with SET_VARLENA_LEN.

If we're going to do this then it's time to play the name game; that is,
pick names we actually like and that work well together.  The original
TOAST patch made things a bit messy in this area.  We should try to
improve the situation now, not make it worse.

We have the following macro names that are commonly used for varlena
struct access:
VARHDRSZVARATT_SIZEP(x)VARATT_SIZE(x)VARATT_DATA(x)VARSIZE(x)        equivalent to VARATT_SIZEVARDATA(x)
equivalentto VARATT_DATA
 

My recollection is that VARHDRSZ, VARSIZE, VARDATA were Berkeley-era
and the other three were added by the TOAST patch.  The lack of
consistency is a bit glaring, and having two ways to do the exact
same thing doesn't seem like an improvement.

A first-cut proposal:
VARHDRSZ        same as now, ie, size of 4-byte headerVARSIZE(x)        for *reading* a 4-byte-header length
wordVARDATA(x)       same as now, ie, ptr + 4 bytesSET_VARSIZE(x, len)    for *writing* a 4-byte-header length word
 

We have to remove VARATT_SIZEP anyway to catch unmodified code, and I'd
propose removing VARATT_SIZE and VARATT_DATA too, as they never caught on.

We'll also need names for the macros that can read the length and find
the data of a datum in either-1-or-4-byte-header format.  These should
probably be named as variants of VARSIZE and VARDATA, but I'm not sure
what exactly; any thoughts?
        regards, tom lane


В списке pgsql-hackers по дате отправления:

Предыдущее
От: "Matt Miller"
Дата:
Сообщение: Re: "anyelement2" pseudotype
Следующее
От: Magnus Hagander
Дата:
Сообщение: Re: integer datetimes