From 0d9dfb06614aba2eb721bdc03960d04a06645ef1 Mon Sep 17 00:00:00 2001
From: Justin Pryzby <pryzbyj@telsasoft.com>
Date: Sun, 15 Dec 2019 17:00:29 -0600
Subject: [PATCH v7 6/6] Print debug line before starting each vacuum step

---
 src/backend/access/heap/vacuumlazy.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/backend/access/heap/vacuumlazy.c b/src/backend/access/heap/vacuumlazy.c
index b03c8a8..08cb2aa 100644
--- a/src/backend/access/heap/vacuumlazy.c
+++ b/src/backend/access/heap/vacuumlazy.c
@@ -1539,6 +1539,10 @@ lazy_vacuum_heap(Relation onerel, LVRelStats *vacrelstats)
 	error_context_stack = &errcallback;
 
 	pg_rusage_init(&ru0);
+
+	ereport(elevel, (errmsg("\"%s\": vacuuming heap",
+					RelationGetRelationName(onerel))));
+
 	npages = 0;
 
 	tupindex = 0;
@@ -1757,6 +1761,9 @@ lazy_vacuum_index(Relation indrel,
 
 	pg_rusage_init(&ru0);
 
+	ereport(elevel, (errmsg("\"%s\": vacuuming index",
+					RelationGetRelationName(indrel))));
+
 	ivinfo.index = indrel;
 	ivinfo.analyze_only = false;
 	ivinfo.report_progress = false;
@@ -1804,6 +1811,9 @@ lazy_cleanup_index(Relation indrel,
 	ivinfo.num_heap_tuples = vacrelstats->new_rel_tuples;
 	ivinfo.strategy = vac_strategy;
 
+	ereport(elevel, (errmsg("cleaning up index \"%s\"",
+					RelationGetRelationName(indrel))));
+
 	stats = index_vacuum_cleanup(&ivinfo, stats);
 
 	if (!stats)
-- 
2.7.4

