pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Avoid CREATE INDEX unique index deduplication.
2+ messages / 1 participants
[nested] [flat]

* pgsql: Avoid CREATE INDEX unique index deduplication.
@ 2020-07-17 16:51 Peter Geoghegan <pg@bowt.ie>
  0 siblings, 0 replies; 2+ messages in thread

From: Peter Geoghegan @ 2020-07-17 16:51 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* pgsql: Avoid CREATE INDEX unique index deduplication.
@ 2020-07-17 16:51 Peter Geoghegan <pg@bowt.ie>
  0 siblings, 0 replies; 2+ messages in thread

From: Peter Geoghegan @ 2020-07-17 16:51 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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
------
REL_13_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/49eb96852b02069600a4f6997dfb388fc37a2778

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



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2020-07-17 16:51 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-07-17 16:51 pgsql: Avoid CREATE INDEX unique index deduplication. Peter Geoghegan <pg@bowt.ie>
2020-07-17 16:51 pgsql: Avoid CREATE INDEX unique index deduplication. Peter Geoghegan <pg@bowt.ie>

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