Review the worker processes strategy and refactor the code.
Instead of creating a new worker process for each table, we now create exactly --tableJobs processes and each of them scan through the tables array in parallel, using a semaphore to pick the next table that's not been picked already. Then when creating the indexes, a main "driver" sub-process is created to allow for asynchronous behaviour, and this driver in turns creates as many processes as we have indexes to create on the target database instance. The VACUUM ANALYZE operation is now started in parallel to the indexes builds, too.
parent
9d4c3665
Please register or sign in to comment