aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/backend/commands/analyze.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/backend/commands/analyze.c b/src/backend/commands/analyze.c
index 9c160c1ff5f..01efdd5b044 100644
--- a/src/backend/commands/analyze.c
+++ b/src/backend/commands/analyze.c
@@ -1534,8 +1534,25 @@ acquire_inherited_sample_rows(Relation onerel, int elevel,
AcquireSampleRowsFunc acquirefunc = acquirefuncs[i];
double childblocks = relblocks[i];
- pgstat_progress_update_param(PROGRESS_ANALYZE_CURRENT_CHILD_TABLE_RELID,
- RelationGetRelid(childrel));
+ /*
+ * Report progress. The sampling function will normally report blocks
+ * done/total, but we need to reset them to 0 here, so that they don't
+ * show an old value until that.
+ */
+ {
+ const int progress_index[] = {
+ PROGRESS_ANALYZE_CURRENT_CHILD_TABLE_RELID,
+ PROGRESS_ANALYZE_BLOCKS_DONE,
+ PROGRESS_ANALYZE_BLOCKS_TOTAL
+ };
+ const int64 progress_vals[] = {
+ RelationGetRelid(childrel),
+ 0,
+ 0,
+ };
+
+ pgstat_progress_update_multi_param(3, progress_index, progress_vals);
+ }
if (childblocks > 0)
{