ind;
Relation *Irel;
int nindexes;
- bool hasindex;
+ bool verbose,
+ instrument,
+ hasindex;
VacAttrStats **vacattrstats;
AnlIndexData *indexdata;
int targrows,
PgStat_Counter startreadtime = 0;
PgStat_Counter startwritetime = 0;
+ verbose = (params->options & VACOPT_VERBOSE) != 0;
+ instrument = (verbose || (AmAutoVacuumWorkerProcess() &&
+ params->log_min_duration >= 0));
if (inh)
ereport(elevel,
(errmsg("analyzing \"%s.%s\" inheritance tree",
save_nestlevel = NewGUCNestLevel();
RestrictSearchPath();
- /* measure elapsed time iff autovacuum logging requires it */
- if (AmAutoVacuumWorkerProcess() && params->log_min_duration >= 0)
+ /*
+ * measure elapsed time if called with verbose or if autovacuum logging
+ * requires it
+ */
+ if (instrument)
{
if (track_io_timing)
{
vac_close_indexes(nindexes, Irel, NoLock);
/* Log the action if appropriate */
- if (AmAutoVacuumWorkerProcess() && params->log_min_duration >= 0)
+ if (instrument)
{
TimestampTz endtime = GetCurrentTimestamp();
- if (params->log_min_duration == 0 ||
+ if (verbose || params->log_min_duration == 0 ||
TimestampDifferenceExceeds(starttime, endtime,
params->log_min_duration))
{
long delay_in_ms;
double read_rate = 0;
double write_rate = 0;
+ char *msgfmt;
StringInfoData buf;
int64 total_blks_hit;
int64 total_blks_read;
*/
initStringInfo(&buf);
- appendStringInfo(&buf, _("automatic analyze of table \"%s.%s.%s\"\n"),
+
+ if (AmAutoVacuumWorkerProcess())
+ msgfmt = _("automatic analyze of table \"%s.%s.%s\"\n");
+ else
+ msgfmt = _("finished analyzing table \"%s.%s.%s\"\n");
+
+ appendStringInfo(&buf, msgfmt,
get_database_name(MyDatabaseId),
get_namespace_name(RelationGetNamespace(onerel)),
RelationGetRelationName(onerel));
(long long) total_blks_dirtied);
appendStringInfo(&buf, _("system usage: %s"), pg_rusage_show(&ru0));
- ereport(LOG,
+ ereport(verbose ? INFO : LOG,
(errmsg_internal("%s", buf.data)));
pfree(buf.data);