Re: Reducing relcache memory usage: deduping index shapes

From: Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com>
To: David Rowley <dgrowleyml(at)gmail(dot)com>
Cc: Yilin Zhang <jiezhilove(at)126(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Andres Freund <andres(at)anarazel(dot)de>, David Geier <geidav(dot)pg(at)gmail(dot)com>
Subject: Re: Reducing relcache memory usage: deduping index shapes
Date: 2026-10-14 12:39:31
Message-ID: CAEze2Wh1gOWFxWMnfUDPnyM9W9KDkV+TSnETERb9nu9mrxnsdw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, 14 Oct 2026 at 09:28, David Rowley <dgrowleyml(at)gmail(dot)com> wrote:
>
> On Tue, 13 Oct 2026 at 07:22, Matthias van de Meent
> <boekewurm+postgres(at)gmail(dot)com> wrote:
> > 0004/0005: Adjust for Proxy -> System /SystemCxt rename
>
> Here's a delta patch with various fixups for v4-0003

Thanks, attached is the adjusted patch series as v5, now again
including "rel.h: const-ify opclass-related fields of RelationData",
which I'd accidentally left out in v4. This should make CFBot happy
again.

[lots of review changes]
> * Various comment adjustments.

Applied, thanks!

> I spent some time running this under Valgrind, accessing the memory of
> a chunk made by SystemContextAlloc() and another after doing
> SystemContextRealloc() on a chunk. Valgrind is correctly giving me
> warnings when I access the byte before the pointer and when I access
> the sentinel byte manually. I don't see any warnings when I access
> bytes that are valid to access.
>
> I'm not aware of any other issues.

Thanks for the review!

Kind regards,

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

Attachment Content-Type Size
v5-0001-rel.h-const-ify-opclass-related-fields-of-Relatio.patch application/x-patch 4.4 KB
v5-0003-Deduplicate-some-index-attributes-in-the-relcache.patch application/x-patch 42.6 KB
v5-0005-Relcache-Use-System-contexts-for-index-info-and-i.patch application/x-patch 2.5 KB
v5-0006-Relcache-Reduce-number-of-allocations-into-shape-.patch application/x-patch 2.6 KB
v5-0004-MemCTX-Add-minimal-system-context-type.patch application/x-patch 22.8 KB
v5-0002-relcache-refactor-RelationInitIndexAccessInfo.patch application/x-patch 5.6 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tatsuya Kawata 2026-10-14 12:45:04 Re: Memoize shows only the last execution's stats for parallel workers
Previous Message Ayush Tiwari 2026-10-14 12:22:03 Re: BUG #19597: getQuadrant: impossible case is reachable