Skip to content

Commit 1db6897

Browse files
committed
Temporarily install debugging in partition_prune test
The buildfarm animal parula has been sporadically failing in the partition_prune test for the past week or so. It appears like an auto-vacuum or auto-analyze has run on one of the partitions of the "ab" table, causing the plan to change. This is unexpected as the table is empty. Here we install some telemetry to find out if this is the case. This also joins in pg_index to see if something has gone wrong with the index which could result in the planner being unable to use that index. We can revert this once we've figured out the cause of the plan instability. Reported-by: Tom Lane Investigation-by: Tom Lane Discussion: https://postgr.es/m/4009739.1710878318%40sss.pgh.pa.us
1 parent 6185c97 commit 1db6897

File tree

2 files changed

+76
-0
lines changed

2 files changed

+76
-0
lines changed

src/test/regress/expected/partition_prune.out

+62
Original file line numberDiff line numberDiff line change
@@ -2449,6 +2449,37 @@ create index ab_a3_b3_a_idx on ab_a3_b3 (a);
24492449
set enable_hashjoin = 0;
24502450
set enable_mergejoin = 0;
24512451
set enable_memoize = 0;
2452+
-- Temporarily install some debugging to investigate plan instability.
2453+
select c.relname,c.relpages,c.reltuples,i.indisvalid,s.autovacuum_count,s.autoanalyze_count
2454+
from pg_class c
2455+
left join pg_stat_all_tables s on c.oid = s.relid
2456+
left join pg_index i on c.oid = i.indexrelid
2457+
where c.relname like 'ab\_%' order by c.relname;
2458+
relname | relpages | reltuples | indisvalid | autovacuum_count | autoanalyze_count
2459+
----------------+----------+-----------+------------+------------------+-------------------
2460+
ab_a1 | 0 | -1 | | 0 | 0
2461+
ab_a1_b1 | 0 | -1 | | 0 | 0
2462+
ab_a1_b1_a_idx | 1 | 0 | t | |
2463+
ab_a1_b2 | 0 | -1 | | 0 | 0
2464+
ab_a1_b2_a_idx | 1 | 0 | t | |
2465+
ab_a1_b3 | 0 | -1 | | 0 | 0
2466+
ab_a1_b3_a_idx | 1 | 0 | t | |
2467+
ab_a2 | 0 | -1 | | 0 | 0
2468+
ab_a2_b1 | 0 | -1 | | 0 | 0
2469+
ab_a2_b1_a_idx | 1 | 0 | t | |
2470+
ab_a2_b2 | 0 | -1 | | 0 | 0
2471+
ab_a2_b2_a_idx | 1 | 0 | t | |
2472+
ab_a2_b3 | 0 | -1 | | 0 | 0
2473+
ab_a2_b3_a_idx | 1 | 0 | t | |
2474+
ab_a3 | 0 | -1 | | 0 | 0
2475+
ab_a3_b1 | 0 | -1 | | 0 | 0
2476+
ab_a3_b1_a_idx | 1 | 0 | t | |
2477+
ab_a3_b2 | 0 | -1 | | 0 | 0
2478+
ab_a3_b2_a_idx | 1 | 0 | t | |
2479+
ab_a3_b3 | 0 | -1 | | 0 | 0
2480+
ab_a3_b3_a_idx | 1 | 0 | t | |
2481+
(21 rows)
2482+
24522483
select explain_parallel_append('select avg(ab.a) from ab inner join lprt_a a on ab.a = a.a where a.a in(0, 0, 1)');
24532484
explain_parallel_append
24542485
--------------------------------------------------------------------------------------------------------
@@ -2824,6 +2855,37 @@ deallocate ab_q3;
28242855
deallocate ab_q4;
28252856
deallocate ab_q5;
28262857
deallocate ab_q6;
2858+
-- Temporarily install some debugging to investigate plan instability.
2859+
select c.relname,c.relpages,c.reltuples,i.indisvalid,s.autovacuum_count,s.autoanalyze_count
2860+
from pg_class c
2861+
left join pg_stat_all_tables s on c.oid = s.relid
2862+
left join pg_index i on c.oid = i.indexrelid
2863+
where c.relname like 'ab\_%' order by c.relname;
2864+
relname | relpages | reltuples | indisvalid | autovacuum_count | autoanalyze_count
2865+
----------------+----------+-----------+------------+------------------+-------------------
2866+
ab_a1 | 0 | -1 | | 0 | 0
2867+
ab_a1_b1 | 0 | -1 | | 0 | 0
2868+
ab_a1_b1_a_idx | 1 | 0 | t | |
2869+
ab_a1_b2 | 0 | -1 | | 0 | 0
2870+
ab_a1_b2_a_idx | 1 | 0 | t | |
2871+
ab_a1_b3 | 0 | -1 | | 0 | 0
2872+
ab_a1_b3_a_idx | 1 | 0 | t | |
2873+
ab_a2 | 0 | -1 | | 0 | 0
2874+
ab_a2_b1 | 0 | -1 | | 0 | 0
2875+
ab_a2_b1_a_idx | 1 | 0 | t | |
2876+
ab_a2_b2 | 0 | -1 | | 0 | 0
2877+
ab_a2_b2_a_idx | 1 | 0 | t | |
2878+
ab_a2_b3 | 0 | -1 | | 0 | 0
2879+
ab_a2_b3_a_idx | 1 | 0 | t | |
2880+
ab_a3 | 0 | -1 | | 0 | 0
2881+
ab_a3_b1 | 0 | -1 | | 0 | 0
2882+
ab_a3_b1_a_idx | 1 | 0 | t | |
2883+
ab_a3_b2 | 0 | -1 | | 0 | 0
2884+
ab_a3_b2_a_idx | 1 | 0 | t | |
2885+
ab_a3_b3 | 0 | -1 | | 0 | 0
2886+
ab_a3_b3_a_idx | 1 | 0 | t | |
2887+
(21 rows)
2888+
28272889
-- UPDATE on a partition subtree has been seen to have problems.
28282890
insert into ab values (1,2);
28292891
explain (analyze, costs off, summary off, timing off)

src/test/regress/sql/partition_prune.sql

+14
Original file line numberDiff line numberDiff line change
@@ -607,6 +607,13 @@ set enable_hashjoin = 0;
607607
set enable_mergejoin = 0;
608608
set enable_memoize = 0;
609609

610+
-- Temporarily install some debugging to investigate plan instability.
611+
select c.relname,c.relpages,c.reltuples,i.indisvalid,s.autovacuum_count,s.autoanalyze_count
612+
from pg_class c
613+
left join pg_stat_all_tables s on c.oid = s.relid
614+
left join pg_index i on c.oid = i.indexrelid
615+
where c.relname like 'ab\_%' order by c.relname;
616+
610617
select explain_parallel_append('select avg(ab.a) from ab inner join lprt_a a on ab.a = a.a where a.a in(0, 0, 1)');
611618

612619
-- Ensure the same partitions are pruned when we make the nested loop
@@ -674,6 +681,13 @@ deallocate ab_q4;
674681
deallocate ab_q5;
675682
deallocate ab_q6;
676683

684+
-- Temporarily install some debugging to investigate plan instability.
685+
select c.relname,c.relpages,c.reltuples,i.indisvalid,s.autovacuum_count,s.autoanalyze_count
686+
from pg_class c
687+
left join pg_stat_all_tables s on c.oid = s.relid
688+
left join pg_index i on c.oid = i.indexrelid
689+
where c.relname like 'ab\_%' order by c.relname;
690+
677691
-- UPDATE on a partition subtree has been seen to have problems.
678692
insert into ab values (1,2);
679693
explain (analyze, costs off, summary off, timing off)

0 commit comments

Comments
 (0)