Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5cc1cd5

Browse files
committed
Report sort phase progress in parallel btree build
We were already reporting it, but only after the parallel workers werefinished, which is visibly much later than what happens in a serialbuild.With this change we report it when the leader starts its own sort phasewhen participating in the build (the normal case). Now this mighthappen a little later than when the workers start their sorting phases,but a) communicating the actual phase start from workers is likely to bea hassle, and b) the sort phase start is pretty fuzzy anyway, sincesorting per se is actually initiated by tuplesort.c internally earlierthan tuplesort_performsort() is called.Backpatch to pg12, where the progress reporting code for CREATE INDEXwent in.Reported-by: Tomas Vondra <tomas.vondra@enterprisedb.com>Author: Matthias van de Meent <boekewurm+postgres@gmail.com>Reviewed-by: Greg Nancarrow <gregn4422@gmail.com>Reviewed-by: Álvaro Herrera <alvherre@alvh.no-ip.org>Discussion:https://postgr.es/m/1128176d-1eee-55d4-37ca-e63644422adb
1 parentab55d74 commit5cc1cd5

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

‎src/backend/access/nbtree/nbtsort.c

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,7 @@ _bt_leafbuild(BTSpool *btspool, BTSpool *btspool2)
547547
}
548548
#endif/* BTREE_BUILD_STATS */
549549

550+
/* Execute the sort */
550551
pgstat_progress_update_param(PROGRESS_CREATEIDX_SUBPHASE,
551552
PROGRESS_BTREE_PHASE_PERFORMSORT_1);
552553
tuplesort_performsort(btspool->sortstate);
@@ -1971,16 +1972,18 @@ _bt_parallel_scan_and_sort(BTSpool *btspool, BTSpool *btspool2,
19711972
true,progress,_bt_build_callback,
19721973
(void*)&buildstate,scan);
19731974

1974-
/*
1975-
* Execute this worker's part of the sort.
1976-
*
1977-
* Unlike leader and serial cases, we cannot avoid calling
1978-
* tuplesort_performsort() for spool2 if it ends up containing no dead
1979-
* tuples (this is disallowed for workers by tuplesort).
1980-
*/
1975+
/* Execute this worker's part of the sort */
1976+
if (progress)
1977+
pgstat_progress_update_param(PROGRESS_CREATEIDX_SUBPHASE,
1978+
PROGRESS_BTREE_PHASE_PERFORMSORT_1);
19811979
tuplesort_performsort(btspool->sortstate);
19821980
if (btspool2)
1981+
{
1982+
if (progress)
1983+
pgstat_progress_update_param(PROGRESS_CREATEIDX_SUBPHASE,
1984+
PROGRESS_BTREE_PHASE_PERFORMSORT_2);
19831985
tuplesort_performsort(btspool2->sortstate);
1986+
}
19841987

19851988
/*
19861989
* Done. Record ambuild statistics, and whether we encountered a broken

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp