mirror of
https://github.com/postgres/postgres.git
synced 2025-11-26 23:43:30 +03:00
Add simple VACUUM progress reporting.
There's a lot more that could be done here yet - in particular, this reports only very coarse-grained information about the index vacuuming phase - but even as it stands, the new pg_stat_progress_vacuum can tell you quite a bit about what a long-running vacuum is actually doing. Amit Langote and Robert Haas, based on earlier work by Vinayak Pokale and Rahila Syed.
This commit is contained in:
@@ -2902,6 +2902,35 @@ pgstat_progress_update_param(int index, int64 val)
|
||||
pgstat_increment_changecount_after(beentry);
|
||||
}
|
||||
|
||||
/*-----------
|
||||
* pgstat_progress_update_params() -
|
||||
*
|
||||
* Automatically update multiple members in st_progress_param[] of own backend
|
||||
* entry.
|
||||
*-----------
|
||||
*/
|
||||
void
|
||||
pgstat_progress_update_multi_param(int nparam, const int *index,
|
||||
const int64 *val)
|
||||
{
|
||||
volatile PgBackendStatus *beentry = MyBEEntry;
|
||||
int i;
|
||||
|
||||
if (!beentry || !pgstat_track_activities || nparam == 0)
|
||||
return;
|
||||
|
||||
pgstat_increment_changecount_before(beentry);
|
||||
|
||||
for (i = 0; i < nparam; ++i)
|
||||
{
|
||||
Assert(index[i] >= 0 && index[i] < PGSTAT_NUM_PROGRESS_PARAM);
|
||||
|
||||
beentry->st_progress_param[index[i]] = val[i];
|
||||
}
|
||||
|
||||
pgstat_increment_changecount_after(beentry);
|
||||
}
|
||||
|
||||
/*-----------
|
||||
* pgstat_progress_end_command() -
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user