pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Geoghegan <pg@bowt.ie>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Truncate line pointer array during VACUUM.
Date: Wed, 07 Apr 2021 15:48:13 +0000
Message-ID: <E1lUAPd-0000Is-Av@gemulon.postgresql.org> (raw)

Truncate line pointer array during VACUUM.

Teach VACUUM to truncate the line pointer array of each heap page when a
contiguous group of LP_UNUSED line pointers appear at the end of the
array -- these unused and unreferenced items are excluded.  This process
occurs during VACUUM's second pass over the heap, right after LP_DEAD
line pointers on the page (those encountered/pruned during the first
pass) are marked LP_UNUSED.

Truncation avoids line pointer bloat with certain workloads,
particularly those involving continual range DELETEs and bulk INSERTs
against the same table.

Also harden heapam code to check for an out-of-range page offset number
in places where we weren't already doing so.

Author: Matthias van de Meent <boekewurm+postgres@gmail.com>
Author: Peter Geoghegan <pg@bowt.ie>
Reviewed-By: Masahiko Sawada <sawada.mshk@gmail.com>
Reviewed-By: Peter Geoghegan <pg@bowt.ie>
Discussion: https://postgr.es/m/CAEze2WjgaQc55Y5f5CQd3L=eS5CZcff2Obxp=O6pto8-f0hC4w@mail.gmail.com
Discussion: https://postgr.es/m/CAH2-Wzn6a64PJM1Ggzm=uvx2otsopJMhFQj_g1rAj4GWr3ZSzw@mail.gmail.com

Branch
------
master

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

Modified Files
--------------
src/backend/access/heap/heapam.c     |  22 +++++--
src/backend/access/heap/pruneheap.c  |   4 ++
src/backend/access/heap/vacuumlazy.c |  16 ++++-
src/backend/storage/page/bufpage.c   | 112 +++++++++++++++++++++++++++++++++--
src/include/storage/bufpage.h        |   1 +
5 files changed, 144 insertions(+), 11 deletions(-)



view thread (2+ messages)  latest in thread

Message-ID: <E1lUAPd-0000Is-Av@gemulon.postgresql.org>
Permalink:  ../E1lUAPd-0000Is-Av@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1lUAPd-0000Is-Av@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: pg@bowt.ie
  Subject: Re: pgsql: Truncate line pointer array during VACUUM.
  In-Reply-To: <E1lUAPd-0000Is-Av@gemulon.postgresql.org>
  References: <E1lUAPd-0000Is-Av@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