1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-28 23:42:10 +03:00

VACUUM VERBOSE: Show dead items for an empty table.

Be consistent about the lines that VACUUM VERBOSE outputs by including
an "index scan not needed: " line for completely empty tables. This
makes the output more readable, especially with multiple distinct VACUUM
operations processed by the same VACUUM command.  It's also more
consistent; even empty tables can use the failsafe, which wasn't
reported in the standard way until now.

Follow-up to commit 6e20f460, which taught VACUUM VERBOSE to be more
consistent about reporting on scanned pages with empty tables.
This commit is contained in:
Peter Geoghegan
2022-04-15 14:20:56 -07:00
parent 357c8455e6
commit bdb71dbe80

View File

@ -715,8 +715,6 @@ heap_vacuum_rel(Relation rel, VacuumParams *params,
_("new relminmxid: %u, which is %d MXIDs ahead of previous value\n"), _("new relminmxid: %u, which is %d MXIDs ahead of previous value\n"),
vacrel->NewRelminMxid, diff); vacrel->NewRelminMxid, diff);
} }
if (orig_rel_pages > 0)
{
if (vacrel->do_index_vacuuming) if (vacrel->do_index_vacuuming)
{ {
if (vacrel->nindexes == 0 || vacrel->num_index_scans == 0) if (vacrel->nindexes == 0 || vacrel->num_index_scans == 0)
@ -737,9 +735,9 @@ heap_vacuum_rel(Relation rel, VacuumParams *params,
} }
appendStringInfo(&buf, msgfmt, appendStringInfo(&buf, msgfmt,
vacrel->lpdead_item_pages, vacrel->lpdead_item_pages,
orig_rel_pages == 0 ? 100.0 :
100.0 * vacrel->lpdead_item_pages / orig_rel_pages, 100.0 * vacrel->lpdead_item_pages / orig_rel_pages,
(long long) vacrel->lpdead_items); (long long) vacrel->lpdead_items);
}
for (int i = 0; i < vacrel->nindexes; i++) for (int i = 0; i < vacrel->nindexes; i++)
{ {
IndexBulkDeleteResult *istat = vacrel->indstats[i]; IndexBulkDeleteResult *istat = vacrel->indstats[i];