diff --git a/src/backend/postmaster/pgstat.c b/src/backend/postmaster/pgstat.c
index ad5b490a27d5f54ed1c69a825f66cf879cec27e6..1fac5af284b4a8399aa0e6dc1cfd7e6e57592996 100644
--- a/src/backend/postmaster/pgstat.c
+++ b/src/backend/postmaster/pgstat.c
@@ -13,7 +13,7 @@
  *
  *	Copyright (c) 2001-2007, PostgreSQL Global Development Group
  *
- *	$PostgreSQL: pgsql/src/backend/postmaster/pgstat.c,v 1.154 2007/04/30 03:23:49 tgl Exp $
+ *	$PostgreSQL: pgsql/src/backend/postmaster/pgstat.c,v 1.155 2007/04/30 16:37:08 tgl Exp $
  * ----------
  */
 #include "postgres.h"
@@ -615,7 +615,7 @@ void allow_immediate_pgstat_restart(void)
  * ----------
  */
 void
-pgstat_report_tabstat(void)
+pgstat_report_tabstat(bool force)
 {
 	static TimestampTz last_report = 0;	
 	TimestampTz now;
@@ -627,10 +627,11 @@ pgstat_report_tabstat(void)
 
 	/*
 	 * Don't send a message unless it's been at least PGSTAT_STAT_INTERVAL
-	 * msec since we last sent one.
+	 * msec since we last sent one, or the caller wants to force stats out.
 	 */
 	now = GetCurrentTransactionStopTimestamp();
-	if (!TimestampDifferenceExceeds(last_report, now, PGSTAT_STAT_INTERVAL))
+	if (!force &&
+		!TimestampDifferenceExceeds(last_report, now, PGSTAT_STAT_INTERVAL))
 		return;
 	last_report = now;
 
@@ -1491,7 +1492,7 @@ pgstat_beshutdown_hook(int code, Datum arg)
 {
 	volatile PgBackendStatus *beentry = MyBEEntry;
 
-	pgstat_report_tabstat();
+	pgstat_report_tabstat(true);
 
 	/*
 	 * Clear my status entry, following the protocol of bumping st_changecount
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index acf12dae6f11492b0f7b505d2668f9c0f6ea23b0..724f2e028d0c6c45d66331b368af61682fa1732a 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.532 2007/04/16 18:21:07 tgl Exp $
+ *	  $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.533 2007/04/30 16:37:08 tgl Exp $
  *
  * NOTES
  *	  this is the "main" module of the postgres backend and
@@ -3444,7 +3444,7 @@ PostgresMain(int argc, char *argv[], const char *username)
 			}
 			else
 			{
-				pgstat_report_tabstat();
+				pgstat_report_tabstat(false);
 
 				set_ps_display("idle", false);
 				pgstat_report_activity("<IDLE>");
diff --git a/src/include/pgstat.h b/src/include/pgstat.h
index 3cfcea7e4b9422e41a87df046a40639b95c1a409..694ee44db19adb2812ac3315891d57bfb962aab9 100644
--- a/src/include/pgstat.h
+++ b/src/include/pgstat.h
@@ -5,7 +5,7 @@
  *
  *	Copyright (c) 2001-2007, PostgreSQL Global Development Group
  *
- *	$PostgreSQL: pgsql/src/include/pgstat.h,v 1.57 2007/03/30 18:34:55 mha Exp $
+ *	$PostgreSQL: pgsql/src/include/pgstat.h,v 1.58 2007/04/30 16:37:08 tgl Exp $
  * ----------
  */
 #ifndef PGSTAT_H
@@ -416,7 +416,7 @@ extern void PgstatCollectorMain(int argc, char *argv[]);
  */
 extern void pgstat_ping(void);
 
-extern void pgstat_report_tabstat(void);
+extern void pgstat_report_tabstat(bool force);
 extern void pgstat_vacuum_tabstat(void);
 extern void pgstat_drop_database(Oid databaseid);
 extern void pgstat_drop_relation(Oid relid);