Commit 24566b35 authored by David Rowley's avatar David Rowley

Attempt to fix unstable regression tests, take 2

Following up on 2dc16efe, 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
parent 64638ccb
...@@ -279,7 +279,7 @@ INSERT INTO ndistinct (a, b, c, filler1) ...@@ -279,7 +279,7 @@ INSERT INTO ndistinct (a, b, c, filler1)
SELECT mod(i,50), mod(i,51), mod(i,32), SELECT mod(i,50), mod(i,51), mod(i,32),
cash_words(mod(i,33)::int::money) cash_words(mod(i,33)::int::money)
FROM generate_series(1,5000) s(i); FROM generate_series(1,5000) s(i);
ANALYZE ndistinct; VACUUM (ANALYZE) ndistinct;
SELECT s.stxkind, d.stxdndistinct SELECT s.stxkind, d.stxdndistinct
FROM pg_statistic_ext s, pg_statistic_ext_data d FROM pg_statistic_ext s, pg_statistic_ext_data d
WHERE s.stxrelid = 'ndistinct'::regclass WHERE s.stxrelid = 'ndistinct'::regclass
...@@ -375,7 +375,7 @@ CREATE INDEX fdeps_abc_idx ON functional_dependencies (a, b, c); ...@@ -375,7 +375,7 @@ CREATE INDEX fdeps_abc_idx ON functional_dependencies (a, b, c);
-- random data (no functional dependencies) -- random data (no functional dependencies)
INSERT INTO functional_dependencies (a, b, c, filler1) 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); 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'''); SELECT * FROM check_estimated_rows('SELECT * FROM functional_dependencies WHERE a = 1 AND b = ''1''');
estimated | actual estimated | actual
-----------+-------- -----------+--------
...@@ -408,7 +408,7 @@ TRUNCATE functional_dependencies; ...@@ -408,7 +408,7 @@ TRUNCATE functional_dependencies;
DROP STATISTICS func_deps_stat; DROP STATISTICS func_deps_stat;
INSERT INTO functional_dependencies (a, b, c, filler1) 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); 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'''); SELECT * FROM check_estimated_rows('SELECT * FROM functional_dependencies WHERE a = 1 AND b = ''1''');
estimated | actual estimated | actual
-----------+-------- -----------+--------
...@@ -741,7 +741,7 @@ SELECT * FROM check_estimated_rows('SELECT * FROM functional_dependencies WHERE ...@@ -741,7 +741,7 @@ SELECT * FROM check_estimated_rows('SELECT * FROM functional_dependencies WHERE
25 | 50 25 | 50
(1 row) (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'); SELECT * FROM check_estimated_rows('SELECT * FROM functional_dependencies WHERE a = 1 AND b = ''1'' AND c = 1');
estimated | actual estimated | actual
-----------+-------- -----------+--------
...@@ -1398,7 +1398,7 @@ INSERT INTO mcv_lists_bool (a, b, c) ...@@ -1398,7 +1398,7 @@ INSERT INTO mcv_lists_bool (a, b, c)
SELECT SELECT
(mod(i,2) = 0), (mod(i,4) = 0), (mod(i,8) = 0) (mod(i,2) = 0), (mod(i,4) = 0), (mod(i,8) = 0)
FROM generate_series(1,10000) s(i); 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'); SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists_bool WHERE a AND b AND c');
estimated | actual estimated | actual
-----------+-------- -----------+--------
......
...@@ -191,7 +191,7 @@ INSERT INTO ndistinct (a, b, c, filler1) ...@@ -191,7 +191,7 @@ INSERT INTO ndistinct (a, b, c, filler1)
cash_words(mod(i,33)::int::money) cash_words(mod(i,33)::int::money)
FROM generate_series(1,5000) s(i); FROM generate_series(1,5000) s(i);
ANALYZE ndistinct; VACUUM (ANALYZE) ndistinct;
SELECT s.stxkind, d.stxdndistinct SELECT s.stxkind, d.stxdndistinct
FROM pg_statistic_ext s, pg_statistic_ext_data d 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); ...@@ -245,7 +245,7 @@ CREATE INDEX fdeps_abc_idx ON functional_dependencies (a, b, c);
INSERT INTO functional_dependencies (a, b, c, filler1) 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); 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'''); SELECT * FROM check_estimated_rows('SELECT * FROM functional_dependencies WHERE a = 1 AND b = ''1''');
...@@ -267,7 +267,7 @@ DROP STATISTICS func_deps_stat; ...@@ -267,7 +267,7 @@ DROP STATISTICS func_deps_stat;
INSERT INTO functional_dependencies (a, b, c, filler1) 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); 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'''); 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; ...@@ -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'); 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'); 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) ...@@ -742,7 +742,7 @@ INSERT INTO mcv_lists_bool (a, b, c)
(mod(i,2) = 0), (mod(i,4) = 0), (mod(i,8) = 0) (mod(i,2) = 0), (mod(i,4) = 0), (mod(i,8) = 0)
FROM generate_series(1,10000) s(i); 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'); SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists_bool WHERE a AND b AND c');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment