Re: reindexing db - Mailing list pgsql-admin

From Ron
Subject Re: reindexing db
Date
Msg-id 98c19d44-8d4c-f608-5432-eef048965552@gmail.com
Whole thread Raw
In response to Re: reindexing db  (Paul Förster <paul.foerster@gmail.com>)
Responses Re: reindexing db  (Paul Förster <paul.foerster@gmail.com>)
List pgsql-admin


On 12/8/20 1:21 AM, Paul Förster wrote:
Hi Ron,

On 08. Dec, 2020, at 07:59, Ron <ronljohnsonjr@gmail.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.

pgsql-admin by date:

Previous
From: Paul Förster
Date:
Subject: Re: reindexing db
Next
From: Paul Förster
Date:
Subject: Re: reindexing db