diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2019-09-27 11:28:24 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2019-09-27 11:28:24 -0400 |
commit | b9bffa004a9980ac235b6ff541ee2fe0e9800372 (patch) | |
tree | 86fa75986a658c45c1bafb09787120e4c4c60247 /src | |
parent | d9cacca2d139d9e0792544f773d2361d8478c131 (diff) | |
download | postgresql-b9bffa004a9980ac235b6ff541ee2fe0e9800372.tar.gz postgresql-b9bffa004a9980ac235b6ff541ee2fe0e9800372.zip |
ANALYZE a_star and its children to avoid plan instability in tests.
We've noted certain EXPLAIN queries on these tables occasionally showing
unexpected plan choices. This seems to happen because VACUUM sometimes
fails to update relpages/reltuples for one of these single-page tables,
due to bgwriter or checkpointer holding a pin on the lone page at just
the wrong time. To ensure those values get set, insert explicit ANALYZE
operations on these tables after we finish populating them. This
doesn't seem to affect any other test cases, so it's a usable fix.
Back-patch to v12. In principle the issue exists further back, but
we have not seen it before v12, so I won't risk back-patching further.
Discussion: https://postgr.es/m/24480.1569518042@sss.pgh.pa.us
Diffstat (limited to 'src')
-rw-r--r-- | src/test/regress/expected/create_misc.out | 7 | ||||
-rw-r--r-- | src/test/regress/sql/create_misc.sql | 8 |
2 files changed, 15 insertions, 0 deletions
diff --git a/src/test/regress/expected/create_misc.out b/src/test/regress/expected/create_misc.out index 8366841ff04..cee35ed02f1 100644 --- a/src/test/regress/expected/create_misc.out +++ b/src/test/regress/expected/create_misc.out @@ -130,6 +130,13 @@ INSERT INTO f_star (class, e) VALUES ('f', '-12'::int2); INSERT INTO f_star (class, f) VALUES ('f', '(11111111,33333333),(22222222,44444444)'::polygon); INSERT INTO f_star (class) VALUES ('f'); +-- Analyze the X_star tables for better plan stability in later tests +ANALYZE a_star; +ANALYZE b_star; +ANALYZE c_star; +ANALYZE d_star; +ANALYZE e_star; +ANALYZE f_star; -- -- for internal portal (cursor) tests -- diff --git a/src/test/regress/sql/create_misc.sql b/src/test/regress/sql/create_misc.sql index d4a63b7aed2..d0b04a821f8 100644 --- a/src/test/regress/sql/create_misc.sql +++ b/src/test/regress/sql/create_misc.sql @@ -192,6 +192,14 @@ INSERT INTO f_star (class, f) INSERT INTO f_star (class) VALUES ('f'); +-- Analyze the X_star tables for better plan stability in later tests +ANALYZE a_star; +ANALYZE b_star; +ANALYZE c_star; +ANALYZE d_star; +ANALYZE e_star; +ANALYZE f_star; + -- -- for internal portal (cursor) tests |