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

From: Alexander Korotkov <aekorotkov(at)gmail(dot)com>
To: Álvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: Alexander Korotkov <akorotkov(at)postgresql(dot)org>, pgsql-hackers(at)lists(dot)postgresql(dot)org, Maxim Orlov <orlovmg(at)gmail(dot)com>, Svetlana Derevyanko <s(dot)derevyanko(at)postgrespro(dot)ru>
Subject: Re: pgsql: reindexdb: Add the index-level REINDEX with multiple jobs
Date: 2025-03-08 10:49:35
Message-ID: CAPpHfdteHycyc2WjXx06kseek3YO_Yaii158i3wOkwm82=HMyg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

On Fri, Mar 7, 2025 at 8:20 PM Álvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> wrote:
>
> On 2024-Mar-25, Alexander Korotkov wrote:
>
> > 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.
>
> I tested this, because of a refactoring suggestion [1] and I find that
> it's rather completely broken.

The code was written with assumption that running
run_reindex_command() with async == true can schedule a number of
queries for a connection. But actually that's not true and everything
is broken.

------
Regards,
Alexander Korotkov
Supabase

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Geoghegan 2025-03-08 16:11:11 pgsql: Make parallel nbtree index scans use an LWLock.
Previous Message Alexander Korotkov 2025-03-08 10:42:41 Re: pgsql: reindexdb: Add the index-level REINDEX with multiple jobs

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexander Korotkov 2025-03-08 12:12:13 Re: pg_atomic_compare_exchange_*() and memory barriers
Previous Message Alexander Korotkov 2025-03-08 10:42:41 Re: pgsql: reindexdb: Add the index-level REINDEX with multiple jobs