@@ -739,6 +739,7 @@ heap_vacuum_rel(Relation rel, VacuumParams *params,
739739{
740740StringInfoData buf ;
741741char * msgfmt ;
742+ BlockNumber orig_rel_pages ;
742743
743744TimestampDifference (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 ,
798799OldestXmin );
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- BlockNumber orig_rel_pages ;
807-
808803if (vacrel -> do_index_vacuuming )
809804{
810- msgfmt = _ ("%u pages from table (%.2f%% of total) had %lld dead item identifiers removed\n" );
811-
812805if (vacrel -> nindexes == 0 || vacrel -> num_index_scans == 0 )
813806appendStringInfoString (& buf ,_ ("index scan not needed: " ));
814807else
815808appendStringInfoString (& buf ,_ ("index scan needed: " ));
809+
810+ msgfmt = _ ("%u pages from table (%.2f%% of total) had %lld dead item identifiers removed\n" );
816811}
817812else
818813{
819- msgfmt = _ ("%u pages from table (%.2f%% of total) have %lld dead item identifiers\n" );
820-
821814if (!vacrel -> failsafe_active )
822815appendStringInfoString (& buf ,_ ("index scan bypassed: " ));
823816else
824817appendStringInfoString (& 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 ;
827821appendStringInfo (& buf ,msgfmt ,
828822vacrel -> lpdead_item_pages ,
829823100.0 * vacrel -> lpdead_item_pages /orig_rel_pages ,
@@ -844,8 +838,6 @@ heap_vacuum_rel(Relation rel, VacuumParams *params,
844838istat -> pages_deleted ,
845839istat -> pages_free );
846840}
847- appendStringInfo (& buf ,_ ("avg read rate: %.3f MB/s, avg write rate: %.3f MB/s\n" ),
848- read_rate ,write_rate );
849841if (track_io_timing )
850842{
851843appendStringInfoString (& buf ,_ ("I/O timings:" ));
@@ -859,12 +851,19 @@ heap_vacuum_rel(Relation rel, VacuumParams *params,
859851 (double ) (pgStatBlockWriteTime - startwritetime ) /1000 );
860852appendStringInfoChar (& 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 );
863861appendStringInfo (& 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
869868ereport (LOG ,
870869(errmsg_internal ("%s" ,buf .data )));