Re: Report index currently being vacuumed in pg_stat_progress_vacuum - Mailing list pgsql-hackers

From Sami Imseih
Subject Re: Report index currently being vacuumed in pg_stat_progress_vacuum
Date
Msg-id CAA5RZ0t2vArQ3EpWSqSQekROuKeaonvgOz=Czkp4Q0tS_krscQ@mail.gmail.com
Whole thread
In response to Re: Report index currently being vacuumed in pg_stat_progress_vacuum  (Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>)
Responses Re: Report index currently being vacuumed in pg_stat_progress_vacuum
List pgsql-hackers
Hi,

> The simpler approach is to have workers report the index they're
> currently on into their own st_progress_param[] slots, which already
> exist per backend, along with their leader's pid. The view then groups
> the worker entries under the matching leader's pid and shows only the
> leader rows, so no new shared memory is needed.

Right, that is what I am thinking also.

> One thing to note is that pg_stat_get_progress_info('VACUUM') itself
> would still return the worker rows, and the grouping happens in the
> pg_stat_progress_vacuum view instead.

Yes, that would be the best way. Do the aggregation on the SQL level
using array_agg.

> While I'm here, in the "vacuuming indexes" phase I also want to report
> the total index pages to scan and the pages scanned so far, for the
> index currently being vacuumed. On a large index this phase can run
> for a long time with no way to tell whether it's making progress.

This was brought up when the "index progress" columns were being worked on, and
knowing the total was not possible for all index types [1]

> Does this direction sound reasonable, or do you see a reason to prefer
> a different approach?

Yes, I think the SQL level aggregation is sane.


[1] https://www.postgresql.org/message-id/CAH2-Wz%3D3JGBty%3D3tXoBoEYYwQNd7fXJuN9oPcnBAj3JYroBv3w%40mail.gmail.com

--
Sami Imseih
Amazon Web Services (AWS)



pgsql-hackers by date:

Previous
From: Jacob Champion
Date:
Subject: Re: First draft of PG 19 release notes
Next
From: Andrey Rachitskiy
Date:
Subject: Re: pg19b1: TRAP: failed Assert("pgstat_bktype_io_stats_valid(bktype_shstats, MyBackendType)")