Thanks for the feedback. I agree with the feedback, except for > need to have ParallelVacuumProgress. I see > parallel_vacuum_update_progress() uses this value but I think it's > better to pass ParallelVacuumState to via IndexVacuumInfo.
I was trying to avoid passing a pointer to ParallelVacuumState in IndexVacuuminfo. ParallelVacuumProgress is implemented in the same way as VacuumSharedCostBalance and VacuumActiveNWorkers. See vacuum.h These values are reset at the start of a parallel vacuum cycle and reset at the end of an index vacuum cycle. This seems like a better approach and less invasive. What would be a reason not to go with this approach? > parallel_vacuum_update_progress() is typically called every 1GB so I > think we don't need to worry about unnecessary update. Also, I think > this code doesn't work when pgstat_track_activities is false. Instead, > I think that in parallel_wait_for_workers_to_finish(), we can check > the value of pvs->nindexes_completed and update the progress if there > is an update or it's first time. I agree that we don’t need to worry about unnecessary updates in parallel_vacuum_update_progress since we are calling every 1GB. I also don't think we should do anything additional in parallel_wait_for_workers_to_finish since here we are only updating every 1 second. Thanks, Sami Imseih Amazon Web Services