pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Reduce memory consumption for pending invalidation messages.
Date: Mon, 16 Aug 2021 20:48:36 +0000
Message-ID: <E1mFjXA-00017r-J9@gemulon.postgresql.org> (raw)

Reduce memory consumption for pending invalidation messages.

The existing data structures in inval.c are fairly inefficient for
the common case of a command or subtransaction that registers a small
number of cache invalidation events.  While this doesn't matter if we
commit right away, it can build up to a lot of bloat in a transaction
that contains many DDL operations.  By making a few more assumptions
about the expected use-case, we can switch to a representation using
densely-packed arrays.  Although this eliminates some data-copying,
it doesn't seem to make much difference time-wise.  But the space
consumption decreases substantially.

Patch by me; thanks to Nathan Bossart for review.

Discussion: https://postgr.es/m/2380555.1622395376@sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/3aafc030a53621e91be2e7c1c72b5f3e8b103486

Modified Files
--------------
src/backend/utils/cache/inval.c | 514 ++++++++++++++++++++++------------------
1 file changed, 286 insertions(+), 228 deletions(-)



Message-ID: <E1mFjXA-00017r-J9@gemulon.postgresql.org>
Permalink:  ../E1mFjXA-00017r-J9@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1mFjXA-00017r-J9@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Reduce memory consumption for pending invalidation messages.
  In-Reply-To: <E1mFjXA-00017r-J9@gemulon.postgresql.org>
  References: <E1mFjXA-00017r-J9@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox