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 deduplication "single value" strategy bug.
Date: Fri, 19 Jun 2020 15:58:56 +0000
Message-ID: <E1jmJPs-0004yH-RZ@gemulon.postgresql.org> (raw)

Fix deduplication "single value" strategy bug.

It was possible for deduplication's single value strategy to mistakenly
believe that a very small duplicate tuple counts as one of the six large
tuples that it aims to leave behind after the page finally splits.  This
could cause slightly suboptimal space utilization with very low
cardinality indexes, though only under fairly narrow conditions.

To fix, be particular about what kind of tuple counts as a
maxpostingsize-capped tuple.  This avoids confusion in the event of a
small tuple that gets "wedged" between two large tuples, where all
tuples on the page are duplicates of the same value.

Discussion: https://postgr.es/m/CAH2-Wz=Y+sgSFc-O3LpiZX-POx2bC+okec2KafERHuzdVa7-rQ@mail.gmail.com
Backpatch: 13-, where deduplication was introduced (by commit 0d861bbb)

Branch
------
REL_13_STABLE

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

Modified Files
--------------
src/backend/access/nbtree/nbtdedup.c | 41 ++++++++++++++++++++++++------------
src/backend/access/nbtree/nbtsort.c  |  2 ++
src/backend/access/nbtree/nbtxlog.c  |  1 +
src/include/access/nbtree.h          |  1 +
4 files changed, 32 insertions(+), 13 deletions(-)



view thread (2+ messages)

Message-ID: <E1jmJPs-0004yH-RZ@gemulon.postgresql.org>
Permalink:  ../E1jmJPs-0004yH-RZ@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1jmJPs-0004yH-RZ@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 deduplication "single value" strategy bug.
  In-Reply-To: <E1jmJPs-0004yH-RZ@gemulon.postgresql.org>
  References: <E1jmJPs-0004yH-RZ@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