Re: Refactor code around GUC default_toast_compression

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Ayush Tiwari <ayushtiwari(dot)slg01(at)gmail(dot)com>
Cc: Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Refactor code around GUC default_toast_compression
Date: 2026-05-01 22:43:44
Message-ID: afUsoKiQ6yriscvT@paquier.xyz
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, May 01, 2026 at 02:44:07PM +0530, Ayush Tiwari wrote:
> 1. The patch includes an unrelated hunk in
> doc/src/sgml/ref/alter_index.sgml, adding text about `ALTER INDEX ...
> ATTACH PARTITION`. That looks like an accidental carry-over from another
> patch and shouldn't be there ig.

Sorry about that. That feels like a rebase fart.

> 2. The comment in src/include/access/toast_compression.h describing
> default_toast_compression looks stale after this change? It still says
> that the GUC value is one of the char values stored in
> pg_attribute.attcompression, but the patch changes it to use the new
> ToastCompressionGucValue enum values instead.(Maybe I'm
> missing something)

Nope, you are missing nothing. I was re-reading the patch and I think
that we could just remove the whole paragraph. Even by doing so we
lose no information.

> 3. One minor point: CompressionIdToMethod() seems to be added as a public
> helper, but I could not find any callers in this patch.

Oops, removed. I may have used it at some point.

> Also,
> pg_column_compression() still keeps its own cmid-to-name switch. If the
> intent is to centralize these mappings in the registry, perhaps that code
> could use the new helper path as well, otherwise the unused helper may
> not be necessary yet (though it might be in future).

Yes, this is part of the extra tweaks that would be needed when added
a new compression method. This part looks at a varlena pointer,
retrieves the on-disk ID. So this is left as-is on purpose, like the
direct TOAST decompress business based on varlena pointers.

Attached is a v2, to keep the CI happy for as long as we can use it.
--
Michael

Attachment Content-Type Size
v2-0001-Refactor-some-code-logic-around-GUC-default_toast.patch text/plain 18.0 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Chao Li 2026-05-02 01:55:30 Re: Refactor code around GUC default_toast_compression
Previous Message Nathan Bossart 2026-05-01 21:41:12 Re: problems with toast.* reloptions