Re: Save a few bytes in pg_attribute

From: Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com>
To: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
Cc: Andres Freund <andres(at)anarazel(dot)de>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Save a few bytes in pg_attribute
Date: 2023-03-22 11:44:09
Message-ID: CAEze2WhKQA1JskkB3j526+ioEP6W_nefidAGJ2XWGbPX71f_Sw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, 22 Mar 2023 at 10:42, Peter Eisentraut
<peter(dot)eisentraut(at)enterprisedb(dot)com> wrote:
>
> On 21.03.23 18:46, Andres Freund wrote:
> > FWIW, I think we should consider getting rid of attcacheoff. I doubt it's
> > worth its weight these days, because deforming via slots starts at the
> > beginning anyway. The overhead of maintaining it is not insubstantial, and
> > it's just architecturally ugly to to update tupledescs continually.
>
> Btw., could attcacheoff be int16?

I had the same thought in '21, and in the patch linked upthread[0] I
added an extra comment on the field:

> + Note: Although the maximum offset encountered in stored tuples is
> + limited to the max BLCKSZ (2**15), FormData_pg_attribute is used for
> + all internal tuples as well, so attcacheoff may be larger for those
> + tuples, and it is therefore not safe to use int16.

So, we can't reduce its size while we use attcacheoff for
(de)serialization of tuples with up to MaxAttributeNumber (=INT16_MAX)
of attributes which each can be larger than one byte (such as in
tuplestore, tuplesort, spilling hash aggregates, ...)

Kind regards,

Matthias van de Meent

[0] https://www.postgresql.org/message-id/CAEze2Wh8-metSryZX_Ubj-uv6kb+2YnzHAejmEdubjhmGusBAg@mail.gmail.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniel Gustafsson 2023-03-22 11:48:18 Re: Question: Do we have a rule to use "PostgreSQL" and "<productname>PostgreSQL</productname>" separately?
Previous Message Drouvot, Bertrand 2023-03-22 11:04:23 Re: [BUG] pg_stat_statements and extended query protocol