Re: Reducing relcache memory usage: deduping index shapes

From: David Geier <geidav(dot)pg(at)gmail(dot)com>
To: Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com>, David Rowley <dgrowleyml(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Andres Freund <andres(at)anarazel(dot)de>
Subject: Re: Reducing relcache memory usage: deduping index shapes
Date: 2026-09-14 07:32:16
Message-ID: dfb1cada-e9c2-488c-80de-3f343ac74cbc@googlemail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi!

>> Can you provide information about how much memory is being saved from 0004+0005?
> Attached the output for a query on catcache/relcache memory context
> data, with output of master and the full patchset.
>
> From Master to 0003, we go from 287872 bytes total to 141312 bytes
> total spent on "index info" contexts (some of which moved into other
> contexts, some new, but a net saving of 130kB). 0004+0005 bring that
> down all the way to 45392 bytes; most of which is just avoiding the
> large overhead of the pre-allocated Blocks of memory, saving another
> 95kB.

I tested your patch with my real world database schema consisting of
38,966 tables and 148,468 indexes. The results are attached. They look
great:

Total used_bytes of all relcache memory contexts shrank from
776 MiB -> 633 MiB. Saving of 143 MiB!

--
David Geier

Attachment Content-Type Size
results.txt text/plain 2.7 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Matthias van de Meent 2026-09-14 08:14:35 Re: Fix unnecessary shared memory page allocation in CalculateShmemSize()
Previous Message Osama Abdul Qader 2026-09-14 07:26:11 Re: Fix unnecessary shared memory page allocation in CalculateShmemSize()