Skip to content

Commit f03a9ca

Browse files
committed
Insert temporary debugging output in regression tests.
We're seeing occasional instability in the plans generated for parallel queries on the "a_star" table hierarchy. This suggests that something is changing the planner's stats for those tables, but that should not be happening within a regression test run. To try to gather some information about what's happening, insert additional queries to check the basic page/tuple counts for these tables, as well as whether any vacuums or analyzes have happened on them. (We expect that only the database-wide VACUUM in sanity_check.sql will have touched them.) I added the probes not only in select_parallel.sql itself, but also in stats.sql, bearing in mind that the stats collector's lag may prevent the initial query from reporting current truth. If any extra vacuum/analyze has happened, the recheck in stats.sql definitely ought to see it. This commit can be reverted once we figure out what's going on. Per suggestion from David Rowley, though I changed the queries around. Discussion: https://postgr.es/m/CA+hUKG+0CxrKRWRMf5ymN3gm+BECHna2B-q1w8onKBep4HasUw@mail.gmail.com
1 parent 1171d7d commit f03a9ca

File tree

4 files changed

+70
-0
lines changed

4 files changed

+70
-0
lines changed

src/test/regress/expected/select_parallel.out

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,33 @@ select round(avg(aa)), sum(aa) from a_star a3;
8989
14 | 355
9090
(1 row)
9191

92+
-- Temporary hack to investigate whether extra vacuum/analyze is happening
93+
select relname, relpages, reltuples
94+
from pg_class
95+
where relname like '__star' order by relname;
96+
relname | relpages | reltuples
97+
---------+----------+-----------
98+
a_star | 1 | 3
99+
b_star | 1 | 4
100+
c_star | 1 | 4
101+
d_star | 1 | 16
102+
e_star | 1 | 7
103+
f_star | 1 | 16
104+
(6 rows)
105+
106+
select relname, vacuum_count, analyze_count, autovacuum_count, autoanalyze_count
107+
from pg_stat_all_tables
108+
where relname like '__star' order by relname;
109+
relname | vacuum_count | analyze_count | autovacuum_count | autoanalyze_count
110+
---------+--------------+---------------+------------------+-------------------
111+
a_star | 1 | 0 | 0 | 0
112+
b_star | 1 | 0 | 0 | 0
113+
c_star | 1 | 0 | 0 | 0
114+
d_star | 1 | 0 | 0 | 0
115+
e_star | 1 | 0 | 0 | 0
116+
f_star | 1 | 0 | 0 | 0
117+
(6 rows)
118+
92119
-- Disable Parallel Append
93120
alter table a_star reset (parallel_workers);
94121
alter table b_star reset (parallel_workers);

src/test/regress/expected/stats.out

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,33 @@ FROM prevstats AS pr;
199199
t
200200
(1 row)
201201

202+
-- Temporary hack to investigate whether extra vacuum/analyze is happening
203+
select relname, relpages, reltuples
204+
from pg_class
205+
where relname like '__star' order by relname;
206+
relname | relpages | reltuples
207+
---------+----------+-----------
208+
a_star | 1 | 3
209+
b_star | 1 | 4
210+
c_star | 1 | 4
211+
d_star | 1 | 16
212+
e_star | 1 | 7
213+
f_star | 1 | 16
214+
(6 rows)
215+
216+
select relname, vacuum_count, analyze_count, autovacuum_count, autoanalyze_count
217+
from pg_stat_all_tables
218+
where relname like '__star' order by relname;
219+
relname | vacuum_count | analyze_count | autovacuum_count | autoanalyze_count
220+
---------+--------------+---------------+------------------+-------------------
221+
a_star | 1 | 0 | 0 | 0
222+
b_star | 1 | 0 | 0 | 0
223+
c_star | 1 | 0 | 0 | 0
224+
d_star | 1 | 0 | 0 | 0
225+
e_star | 1 | 0 | 0 | 0
226+
f_star | 1 | 0 | 0 | 0
227+
(6 rows)
228+
202229
DROP TABLE trunc_stats_test, trunc_stats_test1, trunc_stats_test2, trunc_stats_test3, trunc_stats_test4;
203230
DROP TABLE prevstats;
204231
-- End of Stats Test

src/test/regress/sql/select_parallel.sql

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,14 @@ explain (costs off)
3636
select round(avg(aa)), sum(aa) from a_star;
3737
select round(avg(aa)), sum(aa) from a_star a3;
3838

39+
-- Temporary hack to investigate whether extra vacuum/analyze is happening
40+
select relname, relpages, reltuples
41+
from pg_class
42+
where relname like '__star' order by relname;
43+
select relname, vacuum_count, analyze_count, autovacuum_count, autoanalyze_count
44+
from pg_stat_all_tables
45+
where relname like '__star' order by relname;
46+
3947
-- Disable Parallel Append
4048
alter table a_star reset (parallel_workers);
4149
alter table b_star reset (parallel_workers);

src/test/regress/sql/stats.sql

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,14 @@ SELECT st.heap_blks_read + st.heap_blks_hit >= pr.heap_blks + cl.relpages,
174174
SELECT pr.snap_ts < pg_stat_get_snapshot_timestamp() as snapshot_newer
175175
FROM prevstats AS pr;
176176

177+
-- Temporary hack to investigate whether extra vacuum/analyze is happening
178+
select relname, relpages, reltuples
179+
from pg_class
180+
where relname like '__star' order by relname;
181+
select relname, vacuum_count, analyze_count, autovacuum_count, autoanalyze_count
182+
from pg_stat_all_tables
183+
where relname like '__star' order by relname;
184+
177185
DROP TABLE trunc_stats_test, trunc_stats_test1, trunc_stats_test2, trunc_stats_test3, trunc_stats_test4;
178186
DROP TABLE prevstats;
179187
-- End of Stats Test

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy