pgsql: Report sort phase progress in parallel btree build

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Report sort phase progress in parallel btree build
Date: 2021-06-11 23:08:29
Message-ID: E1lrqGL-0000W1-L5@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Report sort phase progress in parallel btree build

We were already reporting it, but only after the parallel workers were
finished, which is visibly much later than what happens in a serial
build.

With this change we report it when the leader starts its own sort phase
when participating in the build (the normal case). Now this might
happen a little later than when the workers start their sorting phases,
but a) communicating the actual phase start from workers is likely to be
a hassle, and b) the sort phase start is pretty fuzzy anyway, since
sorting per se is actually initiated by tuplesort.c internally earlier
than tuplesort_performsort() is called.

Backpatch to pg12, where the progress reporting code for CREATE INDEX
went in.

Reported-by: Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com>
Author: Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com>
Reviewed-by: Greg Nancarrow <gregn4422(at)gmail(dot)com>
Reviewed-by: Álvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Discussion: https://postgr.es/m/1128176d-1eee-55d4-37ca-e63644422adb

Branch
------
REL_13_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/065ce069ae4fe5f59251435ebfe13e14a2d5874c

Modified Files
--------------
src/backend/access/nbtree/nbtsort.c | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Bruce Momjian 2021-06-11 23:51:45 pgsql: docs: fix incorrect indenting in PG 14 relnotes
Previous Message Tom Lane 2021-06-11 20:12:57 pgsql: Fix multiple crasher bugs in partitioned-table replication logic