Re: reindexing db

From: Ron <ronljohnsonjr(at)gmail(dot)com>
To: pgsql-admin(at)lists(dot)postgresql(dot)org
Subject: Re: reindexing db
Date: 2020-12-08 07:42:44
Message-ID: 98c19d44-8d4c-f608-5432-eef048965552@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On 12/8/20 1:21 AM, Paul Förster wrote:
> Hi Ron,
>
>> On 08. Dec, 2020, at 07:59, Ron <ronljohnsonjr(at)gmail(dot)com> wrote:
>>
>> Probably a habit from my VAX/VMS days, but I prefer to enumerate every table, not only for tracking but so that if the command fails 90% of the way through, I can skip over the the completed portions.
> doing this IMHO defeats the purpose of concurrency because you'd have to issue reindex statements sequentially. Also, but I definitely can't say for sure, reindexdb should skip and report indexes which it has a problem with and then continue to do the remaining indexes. But as I said, I may be wrong with this.

The CONCURRENTLY clause is about rebuilding *an index* online instead of
blocking all other access to the table, not about reindexing multiple tables
in parallel.

Thus, it's perfectly valid to write something like

DB=test
while read line;
do
    psql $DB "REINDEX TABLE $line CONCURRENTLY;"
done < list_of_tables.txt

You might also be able to play with GNU Parallel and concurrently run
multiple "REINDEX TABLE $line CONCURRENTLY;" statements.

--
Angular momentum makes the world go 'round.

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Paul Förster 2020-12-08 07:46:39 Re: reindexing db
Previous Message Paul Förster 2020-12-08 07:21:27 Re: reindexing db