Re: Add index scan progress to pg_stat_progress_vacuum - Mailing list pgsql-hackers

From Imseih (AWS), Sami
Subject Re: Add index scan progress to pg_stat_progress_vacuum
Date
Msg-id 4CD97E17-B9E4-421E-9A53-4317C90EFF35@amazon.com
Whole thread Raw
In response to Add index scan progress to pg_stat_progress_vacuum  ("Imseih (AWS), Sami" <simseih@amazon.com>)
List pgsql-hackers

> One idea would be to add a flag, say report_parallel_vacuum_progress,

> to IndexVacuumInfo struct and expect index AM to check and update the

> parallel index vacuum progress, say every 1GB blocks processed. The

> flag is true only when the leader process is vacuuming an index.

 

Sorry for the long delay on this. I have taken the approach as suggested

by Sawada-san and Robert and attached is v12.

 

1. The patch introduces a new counter in the shared memory already

used by the parallel leader and workers to keep track of the number

of indexes completed. This way there is no reason to loop through

the index status everytime we want to get the status of indexes completed.

 

2. A new function in vacuumparallel.c will be used to update

the progress of a indexes completed by reading from the

counter created in point #1.

 

3. The function is called during the vacuum_delay_point as a

matter of convenience, since it's called in all major vacuum

loops. The function will only do anything if the caller

sets a boolean to report progress. Doing so will also ensure

progress is being reported in case the parallel workers completed

before the leader.

 

4. Rather than adding any complexity to WaitForParallelWorkersToFinish

and introducing a new callback, vacuumparallel.c will wait until

the number of vacuum workers is 0 and then process to call

WaitForParallelWorkersToFinish as it does.

 

5. Went back to the idea of adding a new view called pg_stat_progress_vacuum_index

which is accomplished by adding a new type called VACUUM_PARALLEL in progress.h

 

 

Thanks,

 

Sami Imseih

Amazon Web Servies (AWS)

Attachment

pgsql-hackers by date:

Previous
From: Nathan Bossart
Date:
Subject: Re: Adding Support for Copy callback functionality on COPY TO api
Next
From: Andres Freund
Date:
Subject: Re: shadow variables - pg15 edition