1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-31 17:02:12 +03:00

Add cost-based vacuum delay time to progress views.

This commit adds the amount of time spent sleeping due to
cost-based delay to the pg_stat_progress_vacuum and
pg_stat_progress_analyze system views.  A new configuration
parameter named track_cost_delay_timing, which is off by default,
controls whether this information is gathered.  For vacuum, the
reported value includes the sleep time of any associated parallel
workers.  However, parallel workers only report their sleep time
once per second to avoid overloading the leader process.

Bumps catversion.

Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Co-authored-by: Nathan Bossart <nathandbossart@gmail.com>
Reviewed-by: Sami Imseih <samimseih@gmail.com>
Reviewed-by: Robert Haas <robertmhaas@gmail.com>
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>
Reviewed-by: Masahiro Ikeda <ikedamsh@oss.nttdata.com>
Reviewed-by: Dilip Kumar <dilipbalaut@gmail.com>
Reviewed-by: Sergei Kornilov <sk@zsrv.org>
Discussion: https://postgr.es/m/ZmaXmWDL829fzAVX%40ip-10-97-1-34.eu-west-3.compute.internal
This commit is contained in:
Nathan Bossart
2025-02-11 16:38:14 -06:00
parent e5b0b0ce15
commit bb8dff9995
11 changed files with 144 additions and 5 deletions

View File

@@ -8252,6 +8252,30 @@ COPY postgres_log FROM '/full/path/to/logfile.csv' WITH csv;
</listitem>
</varlistentry>
<varlistentry id="guc-track-cost-delay-timing" xreflabel="track_cost_delay_timing">
<term><varname>track_cost_delay_timing</varname> (<type>boolean</type>)
<indexterm>
<primary><varname>track_cost_delay_timing</varname> configuration parameter</primary>
</indexterm>
</term>
<listitem>
<para>
Enables timing of cost-based vacuum delay (see
<xref linkend="runtime-config-resource-vacuum-cost"/>). This parameter
is off by default, as it will repeatedly query the operating system for
the current time, which may cause significant overhead on some
platforms. You can use the <xref linkend="pgtesttiming"/> tool to
measure the overhead of timing on your system. Cost-based vacuum delay
timing information is displayed in
<link linkend="vacuum-progress-reporting"><structname>pg_stat_progress_vacuum</structname></link>
and
<link linkend="analyze-progress-reporting"><structname>pg_stat_progress_analyze</structname></link>.
Only superusers and users with the appropriate <literal>SET</literal>
privilege can change this setting.
</para>
</listitem>
</varlistentry>
<varlistentry id="guc-track-io-timing" xreflabel="track_io_timing">
<term><varname>track_io_timing</varname> (<type>boolean</type>)
<indexterm>

View File

@@ -5606,6 +5606,18 @@ FROM pg_stat_get_backend_idset() AS backendid;
<literal>acquiring inherited sample rows</literal>.
</para></entry>
</row>
<row>
<entry role="catalog_table_entry"><para role="column_definition">
<structfield>delay_time</structfield> <type>double precision</type>
</para>
<para>
Total time spent sleeping due to cost-based delay (see
<xref linkend="runtime-config-resource-vacuum-cost"/>, in milliseconds
(if <xref linkend="guc-track-cost-delay-timing"/> is enabled, otherwise
zero).
</para></entry>
</row>
</tbody>
</tgroup>
</table>
@@ -6531,6 +6543,21 @@ FROM pg_stat_get_backend_idset() AS backendid;
<literal>cleaning up indexes</literal>.
</para></entry>
</row>
<row>
<entry role="catalog_table_entry"><para role="column_definition">
<structfield>delay_time</structfield> <type>double precision</type>
</para>
<para>
Total time spent sleeping due to cost-based delay (see
<xref linkend="runtime-config-resource-vacuum-cost"/>), in milliseconds
(if <xref linkend="guc-track-cost-delay-timing"/> is enabled, otherwise
zero). This includes the time that any associated parallel workers have
slept. However, parallel workers report their sleep time no more
frequently than once per second, so the reported value may be slightly
stale.
</para></entry>
</row>
</tbody>
</tgroup>
</table>