diff --git a/src/test/regress/expected/stats.out b/src/test/regress/expected/stats.out
index f5be70f..9969d91 100644
--- a/src/test/regress/expected/stats.out
+++ b/src/test/regress/expected/stats.out
@@ -68,6 +68,32 @@ CREATE TABLE trunc_stats_test1(id serial);
 CREATE TABLE trunc_stats_test2(id serial);
 CREATE TABLE trunc_stats_test3(id serial);
 CREATE TABLE trunc_stats_test4(id serial);
+create function wait_for_trunc_stats() returns void as $$
+declare
+  start_time timestamptz := clock_timestamp();
+  updated bool;
+begin
+  -- we don't want to wait forever; loop will exit after 30 seconds
+  for i in 1 .. 300 loop
+
+    SELECT (n_tup_ins > 0) INTO updated
+      FROM pg_stat_user_tables WHERE relname ='trunc_stats_test';
+
+    exit when updated;
+
+    -- wait a little
+    perform pg_sleep(0.1);
+
+    -- reset stats snapshot so we can test again
+    perform pg_stat_clear_snapshot();
+
+  end loop;
+
+  -- report time waited in postmaster log (where it won't change test output)
+  raise log 'wait_for_trunc_stats delayed % seconds',
+    extract(epoch from clock_timestamp() - start_time);
+end
+$$ language plpgsql;
 -- check that n_live_tup is reset to 0 after truncate
 INSERT INTO trunc_stats_test DEFAULT VALUES;
 INSERT INTO trunc_stats_test DEFAULT VALUES;
@@ -142,6 +168,12 @@ SELECT wait_for_stats();
  
 (1 row)
 
+SELECT wait_for_trunc_stats();
+ wait_for_trunc_stats 
+----------------------
+ 
+(1 row)
+
 -- check effects
 SELECT relname, n_tup_ins, n_tup_upd, n_tup_del, n_live_tup, n_dead_tup
   FROM pg_stat_user_tables
@@ -183,4 +215,5 @@ FROM prevstats AS pr;
 (1 row)
 
 DROP TABLE trunc_stats_test, trunc_stats_test1, trunc_stats_test2, trunc_stats_test3, trunc_stats_test4;
+DROP FUNCTION wait_for_trunc_stats();
 -- End of Stats Test
diff --git a/src/test/regress/sql/stats.sql b/src/test/regress/sql/stats.sql
index cd2d592..fc045ed 100644
--- a/src/test/regress/sql/stats.sql
+++ b/src/test/regress/sql/stats.sql
@@ -65,6 +65,33 @@ CREATE TABLE trunc_stats_test2(id serial);
 CREATE TABLE trunc_stats_test3(id serial);
 CREATE TABLE trunc_stats_test4(id serial);
 
+create function wait_for_trunc_stats() returns void as $$
+declare
+  start_time timestamptz := clock_timestamp();
+  updated bool;
+begin
+  -- we don't want to wait forever; loop will exit after 30 seconds
+  for i in 1 .. 300 loop
+
+    SELECT (n_tup_ins > 0) INTO updated
+      FROM pg_stat_user_tables WHERE relname ='trunc_stats_test';
+
+    exit when updated;
+
+    -- wait a little
+    perform pg_sleep(0.1);
+
+    -- reset stats snapshot so we can test again
+    perform pg_stat_clear_snapshot();
+
+  end loop;
+
+  -- report time waited in postmaster log (where it won't change test output)
+  raise log 'wait_for_trunc_stats delayed % seconds',
+    extract(epoch from clock_timestamp() - start_time);
+end
+$$ language plpgsql;
+
 -- check that n_live_tup is reset to 0 after truncate
 INSERT INTO trunc_stats_test DEFAULT VALUES;
 INSERT INTO trunc_stats_test DEFAULT VALUES;
@@ -128,6 +155,7 @@ SELECT pg_sleep(1.0);
 -- wait for stats collector to update
 SELECT wait_for_stats();
 
+SELECT wait_for_trunc_stats();
 -- check effects
 SELECT relname, n_tup_ins, n_tup_upd, n_tup_del, n_live_tup, n_dead_tup
   FROM pg_stat_user_tables
@@ -149,4 +177,5 @@ SELECT pr.snap_ts < pg_stat_get_snapshot_timestamp() as snapshot_newer
 FROM prevstats AS pr;
 
 DROP TABLE trunc_stats_test, trunc_stats_test1, trunc_stats_test2, trunc_stats_test3, trunc_stats_test4;
+DROP FUNCTION wait_for_trunc_stats();
 -- End of Stats Test
