From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: reindexdb: Forbid index-level REINDEX with CONCURRENTLY and mult
Date: Wed, 07 Oct 2026 01:40:27 +0000
Message-ID: <E1xEGdv-00000000cnk-3xHy@gemulon.postgresql.org> (raw)
reindexdb: Forbid index-level REINDEX with CONCURRENTLY and multiple jobs
reindexdb batches the REINDEX commands of all indexes attached to the
same table into a single multi-statement query when using multiple jobs,
as two steps with query "gen" and "run".
Such a query fails with REINDEX CONCURRENTLY, as this command cannot run
inside a transaction block. Batching cannot be avoided because the
indexes of one table have to be re-indexed one at a time to avoid
conflicts across jobs.
Let's error out cleanly on the reindexdb side if this combination of
options is used, instead of having the server complain about that. This
case has not been considered by 47f99a407d.
If there is interest in supporting this combination of options, the code
should be redesigned for this purpose with some better batching, rather
than try to use sets of "gen" and "run" routines. As currently written,
an index-level reindexdb uses a set of "gen" steps with one final "run"
step, which is nice code-wise. (Note: I doubt that that this would be
worth the effort.)
Author: Kirill Reshke <reshkekirill@gmail.com>
Discussion: https://postgr.es/m/CALdSSPiEkAmS+n7Ea9XDMrLjkbQk=CrB7zw1kcq9B47hfKUhXw@mail.gmail.com
Backpatch-through: 17
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/e9c03f0f1bf698c0c603c51baaacfa60dc8c91c7
Modified Files
--------------
src/bin/scripts/reindexdb.c | 3 +++
src/bin/scripts/t/090_reindexdb.pl | 10 ++++++++++
2 files changed, 13 insertions(+)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: michael@paquier.xyz
Subject: Re: pgsql: reindexdb: Forbid index-level REINDEX with CONCURRENTLY and mult
In-Reply-To: <E1xEGdv-00000000cnk-3xHy@gemulon.postgresql.org>
References: <E1xEGdv-00000000cnk-3xHy@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox