| From: | Michael Paquier <michael(at)paquier(dot)xyz> |
|---|---|
| To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgsql: reindexdb: Forbid index-level REINDEX with CONCURRENTLY and mult |
| Date: | 2026-10-07 01:40:28 |
| Message-ID: | E1xEGdw-00000000cnr-05Eu@gemulon.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
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(at)gmail(dot)com>
Discussion: https://postgr.es/m/CALdSSPiEkAmS+n7Ea9XDMrLjkbQk=CrB7zw1kcq9B47hfKUhXw@mail.gmail.com
Backpatch-through: 17
Branch
------
REL_17_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/869c53ff8fe412b0da066d95419753481412a2a4
Modified Files
--------------
src/bin/scripts/reindexdb.c | 3 +++
src/bin/scripts/t/090_reindexdb.pl | 10 ++++++++++
2 files changed, 13 insertions(+)
| From | Date | Subject | |
|---|---|---|---|
| Previous Message | Michael Paquier | 2026-10-07 01:40:27 | pgsql: reindexdb: Forbid index-level REINDEX with CONCURRENTLY and mult |