Re: Track the amount of time waiting due to cost_delay

Sergei Kornilov <sk@zsrv.org>

From: Sergei Kornilov <sk@zsrv.org>
To: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Cc: Dilip Kumar <dilipbalaut@gmail.com>, Masahiro Ikeda <ikedamsh@oss.nttdata.com>, "Imseih (AWS), Sami" <simseih@amazon.com>, Masahiko Sawada <sawada.mshk@gmail.com>, pgsql-hackers@lists.postgresql.org, Robert Haas <robertmhaas@gmail.com>, Nathan Bossart <nathandbossart@gmail.com>
Date: 2024-12-13T21:06:37Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Add delay time to VACUUM/ANALYZE (VERBOSE) and autovacuum logs.

  2. Add cost-based vacuum delay time to progress views.

  3. Add is_analyze parameter to vacuum_delay_point().

  4. Refresh cost-based delay params more frequently in autovacuum

Hello!

+/*
+ * In case of parallel workers, the last time the delay has been reported to
+ * the leader.
+ * We assume this initializes to zero.
+ */
+static instr_time last_report_time;

Maybe last_report_time would be better named worker_last_report_time? (It is not clear to me from the comment that the variable is not used by the leader or autovacuum worker at all)

+		/* Parallel worker */
+		if (IsParallelWorker())

I think this comment doesn't add value (just repeats the code), maybe delete it?

I was surprised that the patch does not add reporting for log_autovacuum_min_duration. But I see it was discussed earlier, great. (postponed for another topic&patch)

- code looks good
- docs pass (not a native English speaker)
- check-world pass

regards, Sergei