Re: Move pg_attribute.attcompression to earlier in struct for reduced size?

From: Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>
To: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Michael Paquier <michael(at)paquier(dot)xyz>, Robert Haas <robertmhaas(at)gmail(dot)com>, dilipbalaut(at)gmail(dot)com, Andres Freund <andres(at)anarazel(dot)de>
Subject: Re: Move pg_attribute.attcompression to earlier in struct for reduced size?
Date: 2021-06-06 21:34:53
Message-ID: CAEudQAoPiVvPmh1gahhqavszBYyC2P0j4BnCdL_tpOk9gktSnA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Em sáb., 5 de jun. de 2021 às 11:16, Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>
escreveu:

> > Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> writes:
>
> > > Now, while this patch does seem to work correctly, it raises a number
> of
> > > weird cpluspluscheck warnings, which I think are attributable to the
> > > new macro definitions. I didn't look into it closely, but I suppose it
> > > should be fixable given sufficient effort:
> >
> > Didn't test, but the first one is certainly fixable by adding a cast,
> > and I guess the others might be as well.
>
> >I get no warnings with this one. I'm a bit wary of leaving
> >VARDATA_COMPRESSED_GET_EXTSIZE unchanged, but at least nothing in this
> >patch requires a cast there.
>
> Hi Alvaro.
>
> Please, would you mind testing with these changes.
> I'm curious to see if anything improves or not.
> 1. Add a const to the attr parameter.
> 2. Remove the cmid variable (and store it).
> 3. Add tail cut.
>
I think that
https://github.com/postgres/postgres/commit/e6241d8e030fbd2746b3ea3f44e728224298f35b#diff-640a50de37a0dc027d9d1c7239e34aed53b184a8ec6e1f653694e458376b19fa
still has space for improvements.

If attr->attcompression is invalid, it doesn't matter, it's better to
decompress.
Besides if it is invalid, currently default_toast_compression is not stored
in attr->attcompression.
I believe this version should be a little faster.
Since it won't double-scan the attributes if it's not really necessary.

regards,
Ranier Vilela

Attachment Content-Type Size
reduce_overhead-on-detoasteds_values.patch application/octet-stream 4.5 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Justin Pryzby 2021-06-06 22:23:05 Re: when the startup process doesn't
Previous Message Tom Lane 2021-06-06 21:29:22 Re: Strangeness with UNIQUE indexes and UTF-8