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

Commitfdfbfa2

Browse files
Reorder log_autovacuum_min_duration log output.
This order seems more natural. It starts with details that areparticular to heap and index data structures, and ends with system-levelcosts incurred during the autovacuum worker's VACUUM/ANALYZE operation.Author: Peter Geoghegan <pg@bowt.ie>Discussion:https://postgr.es/m/CAH2-WzkzxK6ahA9xxsOftRtBX_R0swuHZsvo4QUbak1Bz7hb7Q@mail.gmail.comBackpatch: 14-, which enhanced the log output in various ways.
1 parentde5dcb0 commitfdfbfa2

File tree

2 files changed

+22
-23
lines changed

2 files changed

+22
-23
lines changed

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

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -739,6 +739,7 @@ heap_vacuum_rel(Relation rel, VacuumParams *params,
739739
{
740740
StringInfoDatabuf;
741741
char*msgfmt;
742+
BlockNumberorig_rel_pages;
742743

743744
TimestampDifference(starttime,endtime,&secs,&usecs);
744745

@@ -796,34 +797,27 @@ heap_vacuum_rel(Relation rel, VacuumParams *params,
796797
(long long)vacrel->new_rel_tuples,
797798
(long long)vacrel->new_dead_tuples,
798799
OldestXmin);
799-
appendStringInfo(&buf,
800-
_("buffer usage: %lld hits, %lld misses, %lld dirtied\n"),
801-
(long long)VacuumPageHit,
802-
(long long)VacuumPageMiss,
803-
(long long)VacuumPageDirty);
804-
if (vacrel->rel_pages>0)
800+
orig_rel_pages=vacrel->rel_pages+vacrel->pages_removed;
801+
if (orig_rel_pages>0)
805802
{
806-
BlockNumberorig_rel_pages;
807-
808803
if (vacrel->do_index_vacuuming)
809804
{
810-
msgfmt=_("%u pages from table (%.2f%% of total) had %lld dead item identifiers removed\n");
811-
812805
if (vacrel->nindexes==0||vacrel->num_index_scans==0)
813806
appendStringInfoString(&buf,_("index scan not needed: "));
814807
else
815808
appendStringInfoString(&buf,_("index scan needed: "));
809+
810+
msgfmt=_("%u pages from table (%.2f%% of total) had %lld dead item identifiers removed\n");
816811
}
817812
else
818813
{
819-
msgfmt=_("%u pages from table (%.2f%% of total) have %lld dead item identifiers\n");
820-
821814
if (!vacrel->failsafe_active)
822815
appendStringInfoString(&buf,_("index scan bypassed: "));
823816
else
824817
appendStringInfoString(&buf,_("index scan bypassed by failsafe: "));
818+
819+
msgfmt=_("%u pages from table (%.2f%% of total) have %lld dead item identifiers\n");
825820
}
826-
orig_rel_pages=vacrel->rel_pages+vacrel->pages_removed;
827821
appendStringInfo(&buf,msgfmt,
828822
vacrel->lpdead_item_pages,
829823
100.0*vacrel->lpdead_item_pages /orig_rel_pages,
@@ -844,8 +838,6 @@ heap_vacuum_rel(Relation rel, VacuumParams *params,
844838
istat->pages_deleted,
845839
istat->pages_free);
846840
}
847-
appendStringInfo(&buf,_("avg read rate: %.3f MB/s, avg write rate: %.3f MB/s\n"),
848-
read_rate,write_rate);
849841
if (track_io_timing)
850842
{
851843
appendStringInfoString(&buf,_("I/O timings:"));
@@ -859,12 +851,19 @@ heap_vacuum_rel(Relation rel, VacuumParams *params,
859851
(double) (pgStatBlockWriteTime-startwritetime) /1000);
860852
appendStringInfoChar(&buf,'\n');
861853
}
862-
appendStringInfo(&buf,_("system usage: %s\n"),pg_rusage_show(&ru0));
854+
appendStringInfo(&buf,_("avg read rate: %.3f MB/s, avg write rate: %.3f MB/s\n"),
855+
read_rate,write_rate);
856+
appendStringInfo(&buf,
857+
_("buffer usage: %lld hits, %lld misses, %lld dirtied\n"),
858+
(long long)VacuumPageHit,
859+
(long long)VacuumPageMiss,
860+
(long long)VacuumPageDirty);
863861
appendStringInfo(&buf,
864-
_("WAL usage: %lld records, %lld full page images, %llu bytes"),
862+
_("WAL usage: %lld records, %lld full page images, %llu bytes\n"),
865863
(long long)walusage.wal_records,
866864
(long long)walusage.wal_fpi,
867865
(unsigned long long)walusage.wal_bytes);
866+
appendStringInfo(&buf,_("system usage: %s"),pg_rusage_show(&ru0));
868867

869868
ereport(LOG,
870869
(errmsg_internal("%s",buf.data)));

‎src/backend/commands/analyze.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -777,12 +777,6 @@ do_analyze_rel(Relation onerel, VacuumParams *params,
777777
get_database_name(MyDatabaseId),
778778
get_namespace_name(RelationGetNamespace(onerel)),
779779
RelationGetRelationName(onerel));
780-
appendStringInfo(&buf,_("buffer usage: %lld hits, %lld misses, %lld dirtied\n"),
781-
(long long)AnalyzePageHit,
782-
(long long)AnalyzePageMiss,
783-
(long long)AnalyzePageDirty);
784-
appendStringInfo(&buf,_("avg read rate: %.3f MB/s, avg write rate: %.3f MB/s\n"),
785-
read_rate,write_rate);
786780
if (track_io_timing)
787781
{
788782
appendStringInfoString(&buf,_("I/O timings:"));
@@ -796,6 +790,12 @@ do_analyze_rel(Relation onerel, VacuumParams *params,
796790
(double) (pgStatBlockWriteTime-startwritetime) /1000);
797791
appendStringInfoChar(&buf,'\n');
798792
}
793+
appendStringInfo(&buf,_("avg read rate: %.3f MB/s, avg write rate: %.3f MB/s\n"),
794+
read_rate,write_rate);
795+
appendStringInfo(&buf,_("buffer usage: %lld hits, %lld misses, %lld dirtied\n"),
796+
(long long)AnalyzePageHit,
797+
(long long)AnalyzePageMiss,
798+
(long long)AnalyzePageDirty);
799799
appendStringInfo(&buf,_("system usage: %s"),pg_rusage_show(&ru0));
800800

801801
ereport(LOG,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp