mirror of
https://github.com/postgres/postgres.git
synced 2025-06-30 21:42:05 +03:00
Report progress of CREATE INDEX operations
This uses the progress reporting infrastructure added by c16dc1aca5
,
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
This commit is contained in:
@ -671,6 +671,16 @@ typedef BTScanOpaqueData *BTScanOpaque;
|
||||
#define SK_BT_DESC (INDOPTION_DESC << SK_BT_INDOPTION_SHIFT)
|
||||
#define SK_BT_NULLS_FIRST (INDOPTION_NULLS_FIRST << SK_BT_INDOPTION_SHIFT)
|
||||
|
||||
/*
|
||||
* Constant definition for progress reporting. Phase numbers must match
|
||||
* btbuildphasename.
|
||||
*/
|
||||
/* PROGRESS_CREATEIDX_SUBPHASE_INITIALIZE is 1 (see progress.h) */
|
||||
#define PROGRESS_BTREE_PHASE_INDEXBUILD_TABLESCAN 2
|
||||
#define PROGRESS_BTREE_PHASE_PERFORMSORT_1 3
|
||||
#define PROGRESS_BTREE_PHASE_PERFORMSORT_2 4
|
||||
#define PROGRESS_BTREE_PHASE_LEAF_LOAD 5
|
||||
|
||||
/*
|
||||
* external entry points for btree, in nbtree.c
|
||||
*/
|
||||
@ -784,6 +794,7 @@ extern bytea *btoptions(Datum reloptions, bool validate);
|
||||
extern bool btproperty(Oid index_oid, int attno,
|
||||
IndexAMProperty prop, const char *propname,
|
||||
bool *res, bool *isnull);
|
||||
extern char *btbuildphasename(int64 phasenum);
|
||||
extern IndexTuple _bt_truncate(Relation rel, IndexTuple lastleft,
|
||||
IndexTuple firstright, BTScanInsert itup_key);
|
||||
extern int _bt_keep_natts_fast(Relation rel, IndexTuple lastleft,
|
||||
|
Reference in New Issue
Block a user