| From: | Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com> |
|---|---|
| To: | Yilin Zhang <jiezhilove(at)126(dot)com> |
| Cc: | David Rowley <dgrowleyml(at)gmail(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-06 22:00:57 |
| Message-ID: | CAEze2WiaoHWrWQk+ZBinfQPZz9yDTVaHbAwopdqxWChaEfQ66Q@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Thu, 17 Sept 2026 at 11:56, Yilin Zhang <jiezhilove(at)126(dot)com> wrote:
>
> At 2026-09-08 17:55:36, "Matthias van de Meent" <boekewurm+postgres(at)gmail(dot)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 | Content-Type | Size |
|---|---|---|
| v3-0004-MemCTX-Add-minimal-proxy-context-type-that-just-d.patch | application/octet-stream | 20.1 KB |
| v3-0003-Deduplicate-some-index-attributes-in-the-relcache.patch | application/octet-stream | 42.6 KB |
| v3-0002-relcache-refactor-RelationInitIndexAccessInfo.patch | application/octet-stream | 5.6 KB |
| v3-0005-Relcache-Use-Proxy-contexts-for-index-info-and-in.patch | application/octet-stream | 2.4 KB |
| v3-0006-relcache-Reduce-number-of-allocations-into-shape-.patch | application/octet-stream | 2.6 KB |
| v3-0001-rel.h-const-ify-opclass-related-fields-of-Relatio.patch | application/octet-stream | 4.4 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Zsolt Parragi | 2026-10-06 22:06:26 | Re: [Patch] New pg_stat_tablespace view |
| Previous Message | Tristan Partin | 2026-10-06 22:00:41 | Re: meson: avoid PATH bloat from NLS .mo targets in tmp_install test setup |