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: Avoid CREATE INDEX unique index deduplication.
Date: Fri, 17 Jul 2020 16:51:37 +0000
Message-ID: <E1jwTaD-0005N4-3A@gemulon.postgresql.org> (raw)

Avoid CREATE INDEX unique index deduplication.

There is no advantage to attempting deduplication for a unique index
during CREATE INDEX, since there cannot possibly be any duplicates.
Doing so wastes cycles due to unnecessary copying.  Make sure that we
avoid it consistently.

We already avoided unique index deduplication in the case where there
were some spool2 tuples to merge.  That didn't account for the fact that
spool2 is removed early/unset in the common case where it has no tuples
that need to be merged (i.e. it failed to account for the "spool2 turns
out to be unnecessary" optimization in _bt_spools_heapscan()).

Oversight in commit 0d861bbb, which added nbtree deduplication

Backpatch: 13-, where nbtree deduplication was introduced.

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/5da8bf8bbb5c119d4bd767dbdfaf10efd348c0fd

Modified Files
--------------
src/backend/access/nbtree/nbtsort.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)



view thread (2+ messages)

Message-ID: <E1jwTaD-0005N4-3A@gemulon.postgresql.org>
Permalink:  ../E1jwTaD-0005N4-3A@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1jwTaD-0005N4-3A@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: Avoid CREATE INDEX unique index deduplication.
  In-Reply-To: <E1jwTaD-0005N4-3A@gemulon.postgresql.org>
  References: <E1jwTaD-0005N4-3A@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