Re: Reducing relcache memory usage: deduping index shapes - Mailing list pgsql-hackers

From Matthias van de Meent
Subject Re: Reducing relcache memory usage: deduping index shapes
Date
Msg-id CAEze2WiaoHWrWQk+ZBinfQPZz9yDTVaHbAwopdqxWChaEfQ66Q@mail.gmail.com
Whole thread
In response to Re: Reducing relcache memory usage: deduping index shapes  ("Yilin Zhang" <jiezhilove@126.com>)
List pgsql-hackers
On Thu, 17 Sept 2026 at 11:56, Yilin Zhang <jiezhilove@126.com> wrote:
>
> At 2026-09-08 17:55:36, "Matthias van de Meent" <boekewurm+postgres@gmail.com> wrote:
>
> >Attached is v2 of the patchset. Changelist below:
>
> Hi,
> Thanks for your patches.
> I have some review comments regarding the code below:

Thank you for the review!

[...]
> The IndexSupportDeregister() cleanup inside RelationDestroyRelation() cannot be executed,
> since relation->rd_isvalid = false has already been set in RelationInvalidateRelation().
> Entries in RelShapeCache cannot be removed.
> Is this inconsistent with your design?

Yes, that's a bug.

Attached is version 3, which fixes that bug, does a little more
cleanup, and moves some non-critical optimizations into their own
patch.

Changelist:

0001: Unchanged
0002: Some cosmetic changes, but nothing material
0003:
* Cleaned up a compilerwarnings complaint
* Moved some changes that do bulk allocations in shapectx to 0006
* cosmetic fixes
0004/0005:
* Unchanged
0006:
* Some small changes to IndexSupportInitialize to bulk-allocate into
the Proxy context.
    This saves 3x sizeof(ProxyChunk) memory. Not huge, but every bit
counts when catalogs get to huge sizes.
    These were previously added in v2's 0003.

Kind regards,

Matthias van de Meent
Databricks (https://www.databricks.com)

Attachment

pgsql-hackers by date:

Previous
From: "Tristan Partin"
Date:
Subject: Re: meson: avoid PATH bloat from NLS .mo targets in tmp_install test setup
Next
From: Zsolt Parragi
Date:
Subject: Re: [Patch] New pg_stat_tablespace view