diff options
Diffstat (limited to 'src/backend/commands/analyze.c')
-rw-r--r-- | src/backend/commands/analyze.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/backend/commands/analyze.c b/src/backend/commands/analyze.c index 2a7769b1fd1..f8da32e9aef 100644 --- a/src/backend/commands/analyze.c +++ b/src/backend/commands/analyze.c @@ -344,8 +344,8 @@ do_analyze_rel(Relation onerel, VacuumParams *params, RestrictSearchPath(); /* - * measure elapsed time if called with verbose or if autovacuum logging - * requires it + * When verbose or autovacuum logging is used, initialize a resource usage + * snapshot and optionally track I/O timing. */ if (instrument) { @@ -356,9 +356,11 @@ do_analyze_rel(Relation onerel, VacuumParams *params, } pg_rusage_init(&ru0); - starttime = GetCurrentTimestamp(); } + /* Used for instrumentation and stats report */ + starttime = GetCurrentTimestamp(); + /* * Determine which columns to analyze * @@ -693,9 +695,9 @@ do_analyze_rel(Relation onerel, VacuumParams *params, */ if (!inh) pgstat_report_analyze(onerel, totalrows, totaldeadrows, - (va_cols == NIL)); + (va_cols == NIL), starttime); else if (onerel->rd_rel->relkind == RELKIND_PARTITIONED_TABLE) - pgstat_report_analyze(onerel, 0, 0, (va_cols == NIL)); + pgstat_report_analyze(onerel, 0, 0, (va_cols == NIL), starttime); /* * If this isn't part of VACUUM ANALYZE, let index AMs do cleanup. |