pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tomas Vondra <tomas.vondra@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Reuse BrinDesc and BrinRevmap in brininsert
Date: Sat, 25 Nov 2023 20:01:54 +0000
Message-ID: <E1r6yqf-007EMg-MK@gemulon.postgresql.org> (raw)

Reuse BrinDesc and BrinRevmap in brininsert

The brininsert code used to initialize (and destroy) BrinDesc and
BrinRevmap for each tuple, which is not free. This patch initializes
these structures only once, and reuses them for all inserts in the same
command. The data is passed through indexInfo->ii_AmCache.

This also introduces an optional AM callback "aminsertcleanup" that
allows performing custom cleanup in case simply pfree-ing ii_AmCache is
not sufficient (which is the case when the cache contains TupleDesc,
Buffers, and so on).

Author: Soumyadeep Chakraborty
Reviewed-by: Alvaro Herrera, Matthias van de Meent, Tomas Vondra
Discussion: https://postgr.es/m/CAE-ML%2B9r2%3DaO1wwji1sBN9gvPz2xRAtFUGfnffpd0ZqyuzjamA%40mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/c1ec02be1d79eac95160dea7ced32ace84664617

Modified Files
--------------
contrib/bloom/blutils.c              |  1 +
doc/src/sgml/indexam.sgml            | 17 +++++++-
src/backend/access/brin/brin.c       | 75 ++++++++++++++++++++++++++++++------
src/backend/access/gin/ginutil.c     |  1 +
src/backend/access/gist/gist.c       |  1 +
src/backend/access/hash/hash.c       |  1 +
src/backend/access/index/indexam.c   | 15 ++++++++
src/backend/access/nbtree/nbtree.c   |  1 +
src/backend/access/spgist/spgutils.c |  1 +
src/backend/executor/execIndexing.c  |  5 +++
src/include/access/amapi.h           |  4 ++
src/include/access/brin_internal.h   |  1 +
src/include/access/genam.h           |  2 +
13 files changed, 113 insertions(+), 12 deletions(-)



Message-ID: <E1r6yqf-007EMg-MK@gemulon.postgresql.org>
Permalink:  ../E1r6yqf-007EMg-MK@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1r6yqf-007EMg-MK@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 using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: tomas.vondra@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Reuse BrinDesc and BrinRevmap in brininsert
  In-Reply-To: <E1r6yqf-007EMg-MK@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