pgsql: reindexdb: Add the index-level REINDEX with multiple jobs

From: Alexander Korotkov <akorotkov(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: reindexdb: Add the index-level REINDEX with multiple jobs
Date: 2024-03-25 00:07:24
Message-ID: E1roXs4-005UdX-1V@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

reindexdb: Add the index-level REINDEX with multiple jobs

Straight-forward index-level REINDEX is not supported with multiple jobs as
we cannot control the concurrent processing of multiple indexes depending on
the same relation. Instead, we dedicate the whole table to certain reindex
job. Thus, if indexes in the lists belong to different tables, that gives us
a fair level of parallelism.

This commit teaches get_parallel_object_list() to fetch table names for
indexes in the case of index-level REINDEX. The same tables are grouped
together in the output order, and the list of indexes is also rebuilt to
match that order. Later during processingof that list, we push indexes
belonging to the same table into the same job.

Discussion: https://postgr.es/m/CACG%3DezZU_VwDi-1PN8RUSE6mcYG%2BYx1NH_rJO4%2BKe-mKqLp%3DNw%40mail.gmail.com
Author: Maxim Orlov, Svetlana Derevyanko, Alexander Korotkov
Reviewed-by: Michael Paquier

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/47f99a407de224df6f9c43697d0a9c0a5598b250

Modified Files
--------------
doc/src/sgml/ref/reindexdb.sgml | 3 +-
src/bin/scripts/reindexdb.c | 146 +++++++++++++++++++++++++++++++------
src/bin/scripts/t/090_reindexdb.pl | 8 +-
3 files changed, 130 insertions(+), 27 deletions(-)

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message David Rowley 2024-03-25 01:32:05 pgsql: Allow planner to use Merge Append to efficiently implement UNION
Previous Message Jeff Davis 2024-03-24 23:40:22 pgsql: Fix convert_case(), introduced in 5c40364dd6.

Browse pgsql-hackers by date

  From Date Subject
Next Message Masahiko Sawada 2024-03-25 01:02:18 Re: [PoC] Improve dead tuple storage for lazy vacuum
Previous Message jian he 2024-03-25 00:00:00 Re: Adding OLD/NEW support to RETURNING