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: Fix "single value strategy" index deletion issue.
Date: Wed, 22 Sep 2021 02:01:54 +0000
Message-ID: <E1mSra6-0008VM-5q@gemulon.postgresql.org> (raw)

Fix "single value strategy" index deletion issue.

It is not appropriate for deduplication to apply single value strategy
when triggered by a bottom-up index deletion pass.  This wastes cycles
because later bottom-up deletion passes will overinterpret older
duplicate tuples that deduplication actually just skipped over "by
design".  It also makes bottom-up deletion much less effective for low
cardinality indexes that happen to cross a meaningless "index has single
key value per leaf page" threshold.

To fix, slightly narrow the conditions under which deduplication's
single value strategy is considered.  We already avoided the strategy
for a unique index, since our high level goal must just be to buy time
for VACUUM to run (not to buy space).  We'll now also avoid it when we
just had a bottom-up pass that reported failure.  The two cases share
the same high level goal, and already overlapped significantly, so this
approach is quite natural.

Oversight in commit d168b666, which added bottom-up index deletion.

Author: Peter Geoghegan <pg@bowt.ie>
Discussion: https://postgr.es/m/CAH2-WznaOvM+Gyj-JQ0X=JxoMDxctDTYjiEuETdAGbF5EUc3MA@mail.gmail.com
Backpatch: 14-, where bottom-up deletion was introduced.

Branch
------
REL_14_STABLE

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

Modified Files
--------------
src/backend/access/nbtree/nbtdedup.c  | 36 +++++++++++++++++------------------
src/backend/access/nbtree/nbtinsert.c |  2 +-
src/include/access/nbtree.h           |  2 +-
3 files changed, 19 insertions(+), 21 deletions(-)



view thread (2+ messages)

Message-ID: <E1mSra6-0008VM-5q@gemulon.postgresql.org>
Permalink:  ../E1mSra6-0008VM-5q@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1mSra6-0008VM-5q@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: Fix "single value strategy" index deletion issue.
  In-Reply-To: <E1mSra6-0008VM-5q@gemulon.postgresql.org>
  References: <E1mSra6-0008VM-5q@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