Re: Reducing relcache memory usage: deduping index shapes

From: Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com>
To: David Geier <geidav(dot)pg(at)gmail(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>
Subject: Re: Reducing relcache memory usage: deduping index shapes
Date: 2026-09-02 10:10:47
Message-ID: CAEze2Wj54x1yu+D2rGPo8C7w1_m8-drWFP81sN_ZkUSR1qmocQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, 2 Sept 2026 at 10:09, David Geier <geidav(dot)pg(at)gmail(dot)com> wrote:
>
> >> 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.
> Did you just startup the server and run that query or did you run some
> something first to populate the relcache?

I ran both "\d+ pg_catalog.*" and "\di+ pg_catalog.*" in the session
before running the query, so it should be a representative sample of
all indexes in a freshly initdb'ed system.

> Maybe I'm missing something but in my understanding the relcache is
> populated as relations are accessed.

Correct.

Kind regards,

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Matthias van de Meent 2026-09-02 10:31:14 Re: Reducing relcache memory usage: deduping index shapes
Previous Message David Geier 2026-09-02 09:27:52 Re: Add pg_stat_vfdcache view for VFD cache statistics