Report progress of CREATE INDEX operations

Alvaro Herrera <alvherre@alvh.no-ip.org>

Commit: ab0dfc961b6a821f23d9c40c723d11380ce195a6
Author: Alvaro Herrera <alvherre@alvh.no-ip.org>
Date: 2019-04-02T18:18:08Z
Releases: 12.0
Report progress of CREATE INDEX operations

This uses the progress reporting infrastructure added by c16dc1aca5e0,
adding support for CREATE INDEX and CREATE INDEX CONCURRENTLY.

There are two pieces to this: one is index-AM-agnostic, and the other is
AM-specific.  The latter is fairly elaborate for btrees, including
reportage for parallel index builds and the separate phases that btree
index creation uses; other index AMs, which are much simpler in their
building procedures, have simplistic reporting only, but that seems
sufficient, at least for non-concurrent builds.

The index-AM-agnostic part is fairly complete, providing insight into
the CONCURRENTLY wait phases as well as block-based progress during the
index validation table scan.  (The index validation index scan requires
patching each AM, which has not been included here.)

Reviewers: Rahila Syed, Pavan Deolasee, Tatsuro Yamada
Discussion: https://postgr.es/m/20181220220022.mg63bhk26zdpvmcj@alvherre.pgsql

Files

PathChange+/−
contrib/amcheck/verify_nbtree.c modified +1 −1
contrib/bloom/blinsert.c modified +1 −1
contrib/bloom/blutils.c modified +1 −0
doc/src/sgml/indexam.sgml modified +13 −0
doc/src/sgml/monitoring.sgml modified +223 −1
src/backend/access/brin/brin.c modified +3 −2
src/backend/access/gin/gininsert.c modified +1 −1
src/backend/access/gin/ginutil.c modified +1 −0
src/backend/access/gist/gistbuild.c modified +1 −1
src/backend/access/gist/gist.c modified +1 −0
src/backend/access/hash/hash.c modified +6 −1
src/backend/access/hash/hashsort.c modified +6 −0
src/backend/access/heap/heapam_handler.c modified +107 −0
src/backend/access/nbtree/nbtree.c modified +9 −0
src/backend/access/nbtree/nbtsort.c modified +49 −7
src/backend/access/nbtree/nbtutils.c modified +24 −0
src/backend/access/spgist/spginsert.c modified +1 −1
src/backend/access/spgist/spgutils.c modified +1 −0
src/backend/catalog/index.c modified +54 −3
src/backend/catalog/system_views.sql modified +27 −0
src/backend/commands/indexcmds.c modified +63 −9
src/backend/storage/ipc/standby.c modified +1 −1
src/backend/storage/lmgr/lmgr.c modified +42 −4
src/backend/storage/lmgr/lock.c modified +6 −1
src/backend/utils/adt/amutils.c modified +23 −0
src/backend/utils/adt/pgstatfuncs.c modified +2 −0
src/include/access/amapi.h modified +4 −0
src/include/access/genam.h modified +1 −0
src/include/access/nbtree.h modified +11 −0
src/include/access/tableam.h modified +7 −0
src/include/catalog/catversion.h modified +1 −1
src/include/catalog/pg_proc.dat modified +7 −3
src/include/commands/progress.h modified +36 −1
src/include/pgstat.h modified +3 −2
src/include/storage/lmgr.h modified +2 −2
src/include/storage/lock.h modified +1 −1
src/test/regress/expected/rules.out modified +28 −2

Documentation touched

Discussion