On 12/8/20 1:21 AM, Paul Förster wrote:
Hi Ron,On 08. Dec, 2020, at 07:59, Ron <ronljohnsonjr@xxxxxxxxx> 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.
Angular momentum makes the world go 'round.