Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7720082

Browse files
Add delay time to VACUUM/ANALYZE (VERBOSE) and autovacuum logs.
Commitbb8dff9 added this information to thepg_stat_progress_vacuum and pg_stat_progress_analyze system views.This commit adds the same information to the output of VACUUM andANALYZE with the VERBOSE option and to the autovacuum logs.Suggested-by: Masahiro Ikeda <ikedamsh@oss.nttdata.com>Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>Discussion:https://postgr.es/m/ZmaXmWDL829fzAVX%40ip-10-97-1-34.eu-west-3.compute.internal
1 parent9ad1b3d commit7720082

File tree

3 files changed

+26
-3
lines changed

3 files changed

+26
-3
lines changed

‎doc/src/sgml/config.sgml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8267,9 +8267,12 @@ COPY postgres_log FROM '/full/path/to/logfile.csv' WITH csv;
82678267
platforms. You can use the <xref linkend="pgtesttiming"/> tool to
82688268
measure the overhead of timing on your system. Cost-based vacuum delay
82698269
timing information is displayed in
8270-
<link linkend="vacuum-progress-reporting"><structname>pg_stat_progress_vacuum</structname></link>
8271-
and
8272-
<link linkend="analyze-progress-reporting"><structname>pg_stat_progress_analyze</structname></link>.
8270+
<link linkend="vacuum-progress-reporting"><structname>pg_stat_progress_vacuum</structname></link>,
8271+
<link linkend="analyze-progress-reporting"><structname>pg_stat_progress_analyze</structname></link>,
8272+
in the output of <xref linkend="sql-vacuum"/> when the
8273+
<literal>VERBOSE</literal> option is used, and by autovacuum for
8274+
auto-vacuums and auto-analyzes when
8275+
<xref linkend="guc-log-autovacuum-min-duration"/> is set.
82738276
Only superusers and users with the appropriate <literal>SET</literal>
82748277
privilege can change this setting.
82758278
</para>

‎src/backend/access/heap/vacuumlazy.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1091,6 +1091,17 @@ heap_vacuum_rel(Relation rel, VacuumParams *params,
10911091
istat->pages_deleted,
10921092
istat->pages_free);
10931093
}
1094+
if (track_cost_delay_timing)
1095+
{
1096+
/*
1097+
* We bypass the changecount mechanism because this value is
1098+
* only updated by the calling process. We also rely on the
1099+
* above call to pgstat_progress_end_command() to not clear
1100+
* the st_progress_param array.
1101+
*/
1102+
appendStringInfo(&buf,_("delay time: %.3f ms\n"),
1103+
(double)MyBEEntry->st_progress_param[PROGRESS_VACUUM_DELAY_TIME] /1000000.0);
1104+
}
10941105
if (track_io_timing)
10951106
{
10961107
doubleread_ms= (double) (pgStatBlockReadTime-startreadtime) /1000;

‎src/backend/commands/analyze.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -808,6 +808,15 @@ do_analyze_rel(Relation onerel, VacuumParams *params,
808808
get_database_name(MyDatabaseId),
809809
get_namespace_name(RelationGetNamespace(onerel)),
810810
RelationGetRelationName(onerel));
811+
if (track_cost_delay_timing)
812+
{
813+
/*
814+
* We bypass the changecount mechanism because this value is
815+
* only updated by the calling process.
816+
*/
817+
appendStringInfo(&buf,_("delay time: %.3f ms\n"),
818+
(double)MyBEEntry->st_progress_param[PROGRESS_ANALYZE_DELAY_TIME] /1000000.0);
819+
}
811820
if (track_io_timing)
812821
{
813822
doubleread_ms= (double) (pgStatBlockReadTime-startreadtime) /1000;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp