On Sun, Dec 1, 2019 at 11:01 PM Sergei Kornilov <sk@zsrv.org> wrote:
Hi
> I think I got your point. Your proposal is that it's more efficient if > we make the leader process vacuum the index that can be processed only > the leader process (i.e. indexes not supporting parallel index vacuum) > while workers are processing indexes supporting parallel index vacuum, > right? That way, we can process indexes in parallel as much as > possible.
Right
> So maybe we can call vacuum_or_cleanup_skipped_indexes first > and then call vacuum_or_cleanup_indexes_worker. But I'm not sure that > there are parallel-safe remaining indexes after the leader finished > vacuum_or_cleanup_indexes_worker, as described on your proposal.
I meant that after processing missing indexes (not supporting parallel index vacuum), the leader can start processing indexes that support the parallel index vacuum, along with parallel workers.
Your idea is good, but remember we have always considered a leader as one worker if the leader can participate. If we do what you are suggesting that won't be completely true as a leader will not completely participate in a parallel vacuum. It might be that we don't consider leader equivalent to one worker in the presence of indexes that don't support a parallel vacuum, but I am not sure if that really matters much. I think overall it should not matter much because we won't have that many indexes that don't support a parallel vacuum.