1313 *
1414 * Copyright (c) 2001-2007, PostgreSQL Global Development Group
1515 *
16- * $PostgreSQL: pgsql/src/backend/postmaster/pgstat.c,v 1.154 2007/04/30 03:23:49 tgl Exp $
16+ * $PostgreSQL: pgsql/src/backend/postmaster/pgstat.c,v 1.155 2007/04/30 16:37:08 tgl Exp $
1717 * ----------
1818 */
1919#include "postgres.h"
@@ -615,7 +615,7 @@ void allow_immediate_pgstat_restart(void)
615615 * ----------
616616 */
617617void
618- pgstat_report_tabstat (void )
618+ pgstat_report_tabstat (bool force )
619619{
620620 static TimestampTz last_report = 0 ;
621621 TimestampTz now ;
@@ -627,10 +627,11 @@ pgstat_report_tabstat(void)
627627
628628 /*
629629 * Don't send a message unless it's been at least PGSTAT_STAT_INTERVAL
630- * msec since we last sent one.
630+ * msec since we last sent one, or the caller wants to force stats out .
631631 */
632632 now = GetCurrentTransactionStopTimestamp ();
633- if (!TimestampDifferenceExceeds (last_report , now , PGSTAT_STAT_INTERVAL ))
633+ if (!force &&
634+ !TimestampDifferenceExceeds (last_report , now , PGSTAT_STAT_INTERVAL ))
634635 return ;
635636 last_report = now ;
636637
@@ -1491,7 +1492,7 @@ pgstat_beshutdown_hook(int code, Datum arg)
14911492{
14921493 volatile PgBackendStatus * beentry = MyBEEntry ;
14931494
1494- pgstat_report_tabstat ();
1495+ pgstat_report_tabstat (true );
14951496
14961497 /*
14971498 * Clear my status entry, following the protocol of bumping st_changecount
0 commit comments