pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Robert Haas <rhaas@postgresql.org>
To: pgsql-committers@postgresql.org
Subject: pgsql: Support parallel btree index builds.
Date: Fri, 02 Feb 2018 18:37:11 +0000
Message-ID: <E1ehgD1-0008TG-4S@gemulon.postgresql.org> (raw)

Support parallel btree index builds.

To make this work, tuplesort.c and logtape.c must also support
parallelism, so this patch adds that infrastructure and then applies
it to the particular case of parallel btree index builds.  Testing
to date shows that this can often be 2-3x faster than a serial
index build.

The model for deciding how many workers to use is fairly primitive
at present, but it's better than not having the feature.  We can
refine it as we get more experience.

Peter Geoghegan with some help from Rushabh Lathia.  While Heikki
Linnakangas is not an author of this patch, he wrote other patches
without which this feature would not have been possible, and
therefore the release notes should possibly credit him as an author
of this feature.  Reviewed by Claudio Freire, Heikki Linnakangas,
Thomas Munro, Tels, Amit Kapila, me.

Discussion: http://postgr.es/m/CAM3SWZQKM=Pzc=CAHzRixKjp2eO5Q0Jg1SoFQqeXFQ647JiwqQ@mail.gmail.com
Discussion: http://postgr.es/m/CAH2-Wz=AxWqDoVvGU7dq856S4r6sJAj6DBn7VMtigkB33N5eyg@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/9da0cc35284bdbe8d442d732963303ff0e0a40bc

Modified Files
--------------
contrib/bloom/blinsert.c                      |   3 +-
doc/src/sgml/config.sgml                      |  44 +-
doc/src/sgml/monitoring.sgml                  |  12 +-
doc/src/sgml/ref/create_index.sgml            |  58 ++
doc/src/sgml/ref/create_table.sgml            |   4 +-
src/backend/access/brin/brin.c                |   4 +-
src/backend/access/gin/gininsert.c            |   2 +-
src/backend/access/gist/gistbuild.c           |   2 +-
src/backend/access/hash/hash.c                |   2 +-
src/backend/access/hash/hashsort.c            |   1 +
src/backend/access/heap/heapam.c              |  28 +-
src/backend/access/nbtree/nbtree.c            | 134 +---
src/backend/access/nbtree/nbtsort.c           | 878 +++++++++++++++++++++++++-
src/backend/access/spgist/spginsert.c         |   3 +-
src/backend/access/transam/parallel.c         |  12 +-
src/backend/bootstrap/bootstrap.c             |   2 +-
src/backend/catalog/heap.c                    |   2 +-
src/backend/catalog/index.c                   | 123 +++-
src/backend/catalog/toasting.c                |   1 +
src/backend/commands/cluster.c                |   3 +-
src/backend/commands/indexcmds.c              |   7 +-
src/backend/executor/execParallel.c           |   2 +-
src/backend/executor/nodeAgg.c                |   6 +-
src/backend/executor/nodeSort.c               |   2 +-
src/backend/optimizer/path/allpaths.c         |  18 +-
src/backend/optimizer/path/costsize.c         |   4 +-
src/backend/optimizer/plan/planner.c          | 136 ++++
src/backend/postmaster/pgstat.c               |   3 +
src/backend/storage/file/buffile.c            |  61 +-
src/backend/storage/file/fd.c                 |  10 +
src/backend/utils/adt/orderedsetaggs.c        |   2 +
src/backend/utils/init/globals.c              |   1 +
src/backend/utils/misc/guc.c                  |  10 +
src/backend/utils/misc/postgresql.conf.sample |   3 +-
src/backend/utils/probes.d                    |   2 +-
src/backend/utils/sort/logtape.c              | 199 +++++-
src/backend/utils/sort/tuplesort.c            | 595 ++++++++++++++---
src/include/access/nbtree.h                   |  14 +-
src/include/access/parallel.h                 |   4 +-
src/include/access/relscan.h                  |   1 +
src/include/catalog/index.h                   |   9 +-
src/include/miscadmin.h                       |   1 +
src/include/nodes/execnodes.h                 |   6 +-
src/include/optimizer/paths.h                 |   2 +-
src/include/optimizer/planner.h               |   1 +
src/include/pgstat.h                          |   1 +
src/include/storage/buffile.h                 |   2 +
src/include/storage/fd.h                      |   1 +
src/include/utils/logtape.h                   |  39 +-
src/include/utils/tuplesort.h                 | 132 +++-
src/tools/pgindent/typedefs.list              |   6 +
51 files changed, 2237 insertions(+), 361 deletions(-)



view thread (12+ messages)  latest in thread

Message-ID: <E1ehgD1-0008TG-4S@gemulon.postgresql.org>
Permalink:  ../E1ehgD1-0008TG-4S@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1ehgD1-0008TG-4S@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: rhaas@postgresql.org
  Subject: Re: pgsql: Support parallel btree index builds.
  In-Reply-To: <E1ehgD1-0008TG-4S@gemulon.postgresql.org>
  References: <E1ehgD1-0008TG-4S@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