summaryrefslogtreecommitdiff
path: root/src/backend/access
diff options
context:
space:
mode:
authorNathan Bossart2025-02-14 20:53:28 +0000
committerNathan Bossart2025-02-14 20:53:28 +0000
commit7720082ae53280857f1eacb86134a9a759290f40 (patch)
tree1113f35a3b4bb5cff04dece4723baf018497ae30 /src/backend/access
parent9ad1b3d01f369f1b204324857e58d9283ff0a527 (diff)
Add delay time to VACUUM/ANALYZE (VERBOSE) and autovacuum logs.
Commit bb8dff9995 added this information to the pg_stat_progress_vacuum and pg_stat_progress_analyze system views. This commit adds the same information to the output of VACUUM and ANALYZE with the VERBOSE option and to the autovacuum logs. Suggested-by: Masahiro Ikeda <[email protected]> Author: Bertrand Drouvot <[email protected]> Discussion: https://postgr.es/m/ZmaXmWDL829fzAVX%40ip-10-97-1-34.eu-west-3.compute.internal
Diffstat (limited to 'src/backend/access')
-rw-r--r--src/backend/access/heap/vacuumlazy.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/backend/access/heap/vacuumlazy.c b/src/backend/access/heap/vacuumlazy.c
index 74175e00534..a231854b1e6 100644
--- a/src/backend/access/heap/vacuumlazy.c
+++ b/src/backend/access/heap/vacuumlazy.c
@@ -1091,6 +1091,17 @@ heap_vacuum_rel(Relation rel, VacuumParams *params,
istat->pages_deleted,
istat->pages_free);
}
+ if (track_cost_delay_timing)
+ {
+ /*
+ * We bypass the changecount mechanism because this value is
+ * only updated by the calling process. We also rely on the
+ * above call to pgstat_progress_end_command() to not clear
+ * the st_progress_param array.
+ */
+ appendStringInfo(&buf, _("delay time: %.3f ms\n"),
+ (double) MyBEEntry->st_progress_param[PROGRESS_VACUUM_DELAY_TIME] / 1000000.0);
+ }
if (track_io_timing)
{
double read_ms = (double) (pgStatBlockReadTime - startreadtime) / 1000;