diff --git a/src/backend/commands/analyze.c b/src/backend/commands/analyze.c index 8af12b5c6b..fea1bd6f44 100644 --- a/src/backend/commands/analyze.c +++ b/src/backend/commands/analyze.c @@ -312,6 +312,7 @@ do_analyze_rel(Relation onerel, VacuumParams *params, Oid save_userid; int save_sec_context; int save_nestlevel; + PgStat_Counter startblockreadtime = 0; if (inh) ereport(elevel, @@ -347,6 +348,7 @@ do_analyze_rel(Relation onerel, VacuumParams *params, if (IsAutoVacuumWorkerProcess() && params->log_min_duration >= 0) { pg_rusage_init(&ru0); + startblockreadtime = pgStatBlockReadTime; if (params->log_min_duration > 0) starttime = GetCurrentTimestamp(); } @@ -686,10 +688,11 @@ do_analyze_rel(Relation onerel, VacuumParams *params, TimestampDifferenceExceeds(starttime, GetCurrentTimestamp(), params->log_min_duration)) ereport(LOG, - (errmsg("automatic analyze of table \"%s.%s.%s\" system usage: %s", + (errmsg("automatic analyze of table \"%s.%s.%s\" system usage: IO read time %.2f s, %s", get_database_name(MyDatabaseId), get_namespace_name(RelationGetNamespace(onerel)), RelationGetRelationName(onerel), + (double) (pgStatBlockReadTime - startblockreadtime)/1000000, pg_rusage_show(&ru0)))); }