Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita4fac4f

Browse files
committed
Attempt to fix unstable Result Cache regression tests
force_parallel_mode = regress is causing a few more problems than Ithought. It seems that both the leader and the single worker cancontribute to the execution. I had mistakenly thought that only the workerprocess would do any work. Since it's not deterministic as to whichof the two processes will get a chance to work on the plan, it seems justbetter to disable force_parallel_mode for these tests. At least doingthis seems better than changing to EXPLAIN only rather than EXPLAINANALYZE.Additionally, I overlooked the fact that the number of executions of thesub-plan below a Result Cache will execute a varying number of timesdepending on cache eviction. 32-bit machines will use less memory andevict fewer tuples from the cache. That results in the subnode beingexecuted fewer times on 32-bit machines. Let's just blank out the numberof loops in each node.
1 parent2bda93f commita4fac4f

File tree

2 files changed

+31
-21
lines changed

2 files changed

+31
-21
lines changed

‎src/test/regress/expected/resultcache.out

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -23,28 +23,32 @@ begin
2323
ln := regexp_replace(ln, 'Evictions: \d+', 'Evictions: N');
2424
ln := regexp_replace(ln, 'Memory Usage: \d+', 'Memory Usage: N');
2525
ln := regexp_replace(ln, 'Heap Fetches: \d+', 'Heap Fetches: N');
26+
ln := regexp_replace(ln, 'loops=\d+', 'loops=N');
2627
return next ln;
2728
end loop;
2829
end;
2930
$$;
3031
-- Ensure we get a result cache on the inner side of the nested loop
3132
SET enable_hashjoin TO off;
3233
SET enable_bitmapscan TO off;
34+
-- force_parallel_mode = regress can cause some instability in EXPLAIN ANALYZE
35+
-- output, so let's ensure that we turn it off.
36+
SET force_parallel_mode TO off;
3337
SELECT explain_resultcache('
3438
SELECT COUNT(*),AVG(t1.unique1) FROM tenk1 t1
3539
INNER JOIN tenk1 t2 ON t1.unique1 = t2.twenty
3640
WHERE t2.unique1 < 1000;', false);
37-
explain_resultcache
38-
--------------------------------------------------------------------------------------------
39-
Aggregate (actual rows=1 loops=1)
40-
-> Nested Loop (actual rows=1000 loops=1)
41-
-> Seq Scan on tenk1 t2 (actual rows=1000 loops=1)
41+
explain_resultcache
42+
-------------------------------------------------------------------------------------------
43+
Aggregate (actual rows=1 loops=N)
44+
-> Nested Loop (actual rows=1000 loops=N)
45+
-> Seq Scan on tenk1 t2 (actual rows=1000 loops=N)
4246
Filter: (unique1 < 1000)
4347
Rows Removed by Filter: 9000
44-
-> Result Cache (actual rows=1 loops=1000)
48+
-> Result Cache (actual rows=1 loops=N)
4549
Cache Key: t2.twenty
4650
Hits: 980 Misses: 20 Evictions: Zero Overflows: 0 Memory Usage: NkB
47-
-> Index Only Scan using tenk1_unique1 on tenk1 t1 (actual rows=1 loops=20)
51+
-> Index Only Scan using tenk1_unique1 on tenk1 t1 (actual rows=1 loops=N)
4852
Index Cond: (unique1 = t2.twenty)
4953
Heap Fetches: N
5054
(11 rows)
@@ -63,17 +67,17 @@ SELECT explain_resultcache('
6367
SELECT COUNT(*),AVG(t2.unique1) FROM tenk1 t1,
6468
LATERAL (SELECT t2.unique1 FROM tenk1 t2 WHERE t1.twenty = t2.unique1) t2
6569
WHERE t1.unique1 < 1000;', false);
66-
explain_resultcache
67-
--------------------------------------------------------------------------------------------
68-
Aggregate (actual rows=1 loops=1)
69-
-> Nested Loop (actual rows=1000 loops=1)
70-
-> Seq Scan on tenk1 t1 (actual rows=1000 loops=1)
70+
explain_resultcache
71+
-------------------------------------------------------------------------------------------
72+
Aggregate (actual rows=1 loops=N)
73+
-> Nested Loop (actual rows=1000 loops=N)
74+
-> Seq Scan on tenk1 t1 (actual rows=1000 loops=N)
7175
Filter: (unique1 < 1000)
7276
Rows Removed by Filter: 9000
73-
-> Result Cache (actual rows=1 loops=1000)
77+
-> Result Cache (actual rows=1 loops=N)
7478
Cache Key: t1.twenty
7579
Hits: 980 Misses: 20 Evictions: Zero Overflows: 0 Memory Usage: NkB
76-
-> Index Only Scan using tenk1_unique1 on tenk1 t2 (actual rows=1 loops=20)
80+
-> Index Only Scan using tenk1_unique1 on tenk1 t2 (actual rows=1 loops=N)
7781
Index Cond: (unique1 = t1.twenty)
7882
Heap Fetches: N
7983
(11 rows)
@@ -97,23 +101,24 @@ SELECT explain_resultcache('
97101
SELECT COUNT(*),AVG(t1.unique1) FROM tenk1 t1
98102
INNER JOIN tenk1 t2 ON t1.unique1 = t2.thousand
99103
WHERE t2.unique1 < 1200;', true);
100-
explain_resultcache
101-
----------------------------------------------------------------------------------------------
102-
Aggregate (actual rows=1 loops=1)
103-
-> Nested Loop (actual rows=1200 loops=1)
104-
-> Seq Scan on tenk1 t2 (actual rows=1200 loops=1)
104+
explain_resultcache
105+
-------------------------------------------------------------------------------------------
106+
Aggregate (actual rows=1 loops=N)
107+
-> Nested Loop (actual rows=1200 loops=N)
108+
-> Seq Scan on tenk1 t2 (actual rows=1200 loops=N)
105109
Filter: (unique1 < 1200)
106110
Rows Removed by Filter: 8800
107-
-> Result Cache (actual rows=1 loops=1200)
111+
-> Result Cache (actual rows=1 loops=N)
108112
Cache Key: t2.thousand
109113
Hits: N Misses: N Evictions: N Overflows: 0 Memory Usage: NkB
110-
-> Index Only Scan using tenk1_unique1 on tenk1 t1 (actual rows=1 loops=1028)
114+
-> Index Only Scan using tenk1_unique1 on tenk1 t1 (actual rows=1 loops=N)
111115
Index Cond: (unique1 = t2.thousand)
112116
Heap Fetches: N
113117
(11 rows)
114118

115119
RESET enable_mergejoin;
116120
RESET work_mem;
121+
RESET force_parallel_mode;
117122
RESET enable_bitmapscan;
118123
RESET enable_hashjoin;
119124
-- Test parallel plans with Result Cache.

‎src/test/regress/sql/resultcache.sql

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ begin
2424
ln := regexp_replace(ln,'Evictions:\d+','Evictions: N');
2525
ln := regexp_replace(ln,'Memory Usage:\d+','Memory Usage: N');
2626
ln := regexp_replace(ln,'Heap Fetches:\d+','Heap Fetches: N');
27+
ln := regexp_replace(ln,'loops=\d+','loops=N');
2728
return next ln;
2829
end loop;
2930
end;
@@ -32,6 +33,9 @@ $$;
3233
-- Ensure we get a result cache on the inner side of the nested loop
3334
SET enable_hashjoin TO off;
3435
SET enable_bitmapscan TO off;
36+
-- force_parallel_mode = regress can cause some instability in EXPLAIN ANALYZE
37+
-- output, so let's ensure that we turn it off.
38+
SET force_parallel_mode TO off;
3539
SELECT explain_resultcache('
3640
SELECT COUNT(*),AVG(t1.unique1) FROM tenk1 t1
3741
INNER JOIN tenk1 t2 ON t1.unique1 = t2.twenty
@@ -65,6 +69,7 @@ INNER JOIN tenk1 t2 ON t1.unique1 = t2.thousand
6569
WHERE t2.unique1 < 1200;', true);
6670
RESET enable_mergejoin;
6771
RESET work_mem;
72+
RESET force_parallel_mode;
6873
RESET enable_bitmapscan;
6974
RESET enable_hashjoin;
7075

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp