Attempt to fix unstable regression tests, take 2
authorDavid Rowley <drowley@postgresql.org>
Mon, 30 Mar 2020 10:41:11 +0000 (23:41 +1300)
committerDavid Rowley <drowley@postgresql.org>
Mon, 30 Mar 2020 10:41:11 +0000 (23:41 +1300)
Following up on 2dc16efed, petalura has suffered some additional
failures in stats_ext which again appear to be around the timing of an
autovacuum during the test, causing instability in the row estimates.

Again, let's fix this by explicitly performing a VACUUM on the table
and not leave it to happen by chance of an autovacuum pass.

Discussion: https://postgr.es/m/CAApHDvok5hmXr%2BbUbJe7%2B2sQzWo4B_QzSk7RKFR9fP6BjYXx5g%40mail.gmail.com

src/test/regress/expected/stats_ext.out
src/test/regress/sql/stats_ext.sql

index f71f76c5cdda9fb39cc2b35e21b277cb45e9fcaa..81288729fd0bdf9aad22356954af9602c789e6d6 100644 (file)
@@ -279,7 +279,7 @@ INSERT INTO ndistinct (a, b, c, filler1)
      SELECT mod(i,50), mod(i,51), mod(i,32),
             cash_words(mod(i,33)::int::money)
        FROM generate_series(1,5000) s(i);
-ANALYZE ndistinct;
+VACUUM (ANALYZE) ndistinct;
 SELECT s.stxkind, d.stxdndistinct
   FROM pg_statistic_ext s, pg_statistic_ext_data d
  WHERE s.stxrelid = 'ndistinct'::regclass
@@ -375,7 +375,7 @@ CREATE INDEX fdeps_abc_idx ON functional_dependencies (a, b, c);
 -- random data (no functional dependencies)
 INSERT INTO functional_dependencies (a, b, c, filler1)
      SELECT mod(i, 23), mod(i, 29), mod(i, 31), i FROM generate_series(1,5000) s(i);
-ANALYZE functional_dependencies;
+VACUUM (ANALYZE) functional_dependencies;
 SELECT * FROM check_estimated_rows('SELECT * FROM functional_dependencies WHERE a = 1 AND b = ''1''');
  estimated | actual 
 -----------+--------
@@ -408,7 +408,7 @@ TRUNCATE functional_dependencies;
 DROP STATISTICS func_deps_stat;
 INSERT INTO functional_dependencies (a, b, c, filler1)
      SELECT mod(i,100), mod(i,50), mod(i,25), i FROM generate_series(1,5000) s(i);
-ANALYZE functional_dependencies;
+VACUUM (ANALYZE) functional_dependencies;
 SELECT * FROM check_estimated_rows('SELECT * FROM functional_dependencies WHERE a = 1 AND b = ''1''');
  estimated | actual 
 -----------+--------
@@ -741,7 +741,7 @@ SELECT * FROM check_estimated_rows('SELECT * FROM functional_dependencies WHERE
         25 |     50
 (1 row)
 
-ANALYZE functional_dependencies;
+VACUUM (ANALYZE) functional_dependencies;
 SELECT * FROM check_estimated_rows('SELECT * FROM functional_dependencies WHERE a = 1 AND b = ''1'' AND c = 1');
  estimated | actual 
 -----------+--------
@@ -1398,7 +1398,7 @@ INSERT INTO mcv_lists_bool (a, b, c)
      SELECT
          (mod(i,2) = 0), (mod(i,4) = 0), (mod(i,8) = 0)
      FROM generate_series(1,10000) s(i);
-ANALYZE mcv_lists_bool;
+VACUUM (ANALYZE) mcv_lists_bool;
 SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists_bool WHERE a AND b AND c');
  estimated | actual 
 -----------+--------
index 46a219e11eeaa3fcfb478c98872bd6ecc747d8c8..8e2dec686a7d6681cc3f023c80f4b1366eb7025d 100644 (file)
@@ -191,7 +191,7 @@ INSERT INTO ndistinct (a, b, c, filler1)
             cash_words(mod(i,33)::int::money)
        FROM generate_series(1,5000) s(i);
 
-ANALYZE ndistinct;
+VACUUM (ANALYZE) ndistinct;
 
 SELECT s.stxkind, d.stxdndistinct
   FROM pg_statistic_ext s, pg_statistic_ext_data d
@@ -245,7 +245,7 @@ CREATE INDEX fdeps_abc_idx ON functional_dependencies (a, b, c);
 INSERT INTO functional_dependencies (a, b, c, filler1)
      SELECT mod(i, 23), mod(i, 29), mod(i, 31), i FROM generate_series(1,5000) s(i);
 
-ANALYZE functional_dependencies;
+VACUUM (ANALYZE) functional_dependencies;
 
 SELECT * FROM check_estimated_rows('SELECT * FROM functional_dependencies WHERE a = 1 AND b = ''1''');
 
@@ -267,7 +267,7 @@ DROP STATISTICS func_deps_stat;
 INSERT INTO functional_dependencies (a, b, c, filler1)
      SELECT mod(i,100), mod(i,50), mod(i,25), i FROM generate_series(1,5000) s(i);
 
-ANALYZE functional_dependencies;
+VACUUM (ANALYZE) functional_dependencies;
 
 SELECT * FROM check_estimated_rows('SELECT * FROM functional_dependencies WHERE a = 1 AND b = ''1''');
 
@@ -396,7 +396,7 @@ ALTER TABLE functional_dependencies ALTER COLUMN c TYPE numeric;
 
 SELECT * FROM check_estimated_rows('SELECT * FROM functional_dependencies WHERE a = 1 AND b = ''1'' AND c = 1');
 
-ANALYZE functional_dependencies;
+VACUUM (ANALYZE) functional_dependencies;
 
 SELECT * FROM check_estimated_rows('SELECT * FROM functional_dependencies WHERE a = 1 AND b = ''1'' AND c = 1');
 
@@ -742,7 +742,7 @@ INSERT INTO mcv_lists_bool (a, b, c)
          (mod(i,2) = 0), (mod(i,4) = 0), (mod(i,8) = 0)
      FROM generate_series(1,10000) s(i);
 
-ANALYZE mcv_lists_bool;
+VACUUM (ANALYZE) mcv_lists_bool;
 
 SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists_bool WHERE a AND b AND c');