diff --git a/src/test/regress/expected/resultcache.out b/src/test/regress/expected/resultcache.out index 65d9e25169..7f4bf95f3f 100644 --- a/src/test/regress/expected/resultcache.out +++ b/src/test/regress/expected/resultcache.out @@ -23,6 +23,7 @@ begin ln := regexp_replace(ln, 'Evictions: \d+', 'Evictions: N'); ln := regexp_replace(ln, 'Memory Usage: \d+', 'Memory Usage: N'); ln := regexp_replace(ln, 'Heap Fetches: \d+', 'Heap Fetches: N'); + ln := regexp_replace(ln, 'loops=\d+', 'loops=N'); return next ln; end loop; end; @@ -30,21 +31,24 @@ $$; -- Ensure we get a result cache on the inner side of the nested loop SET enable_hashjoin TO off; SET enable_bitmapscan TO off; +-- force_parallel_mode = regress can cause some instability in EXPLAIN ANALYZE +-- output, so let's ensure that we turn it off. +SET force_parallel_mode TO off; SELECT explain_resultcache(' SELECT COUNT(*),AVG(t1.unique1) FROM tenk1 t1 INNER JOIN tenk1 t2 ON t1.unique1 = t2.twenty WHERE t2.unique1 < 1000;', false); - explain_resultcache --------------------------------------------------------------------------------------------- - Aggregate (actual rows=1 loops=1) - -> Nested Loop (actual rows=1000 loops=1) - -> Seq Scan on tenk1 t2 (actual rows=1000 loops=1) + explain_resultcache +------------------------------------------------------------------------------------------- + Aggregate (actual rows=1 loops=N) + -> Nested Loop (actual rows=1000 loops=N) + -> Seq Scan on tenk1 t2 (actual rows=1000 loops=N) Filter: (unique1 < 1000) Rows Removed by Filter: 9000 - -> Result Cache (actual rows=1 loops=1000) + -> Result Cache (actual rows=1 loops=N) Cache Key: t2.twenty Hits: 980 Misses: 20 Evictions: Zero Overflows: 0 Memory Usage: NkB - -> Index Only Scan using tenk1_unique1 on tenk1 t1 (actual rows=1 loops=20) + -> Index Only Scan using tenk1_unique1 on tenk1 t1 (actual rows=1 loops=N) Index Cond: (unique1 = t2.twenty) Heap Fetches: N (11 rows) @@ -63,17 +67,17 @@ SELECT explain_resultcache(' SELECT COUNT(*),AVG(t2.unique1) FROM tenk1 t1, LATERAL (SELECT t2.unique1 FROM tenk1 t2 WHERE t1.twenty = t2.unique1) t2 WHERE t1.unique1 < 1000;', false); - explain_resultcache --------------------------------------------------------------------------------------------- - Aggregate (actual rows=1 loops=1) - -> Nested Loop (actual rows=1000 loops=1) - -> Seq Scan on tenk1 t1 (actual rows=1000 loops=1) + explain_resultcache +------------------------------------------------------------------------------------------- + Aggregate (actual rows=1 loops=N) + -> Nested Loop (actual rows=1000 loops=N) + -> Seq Scan on tenk1 t1 (actual rows=1000 loops=N) Filter: (unique1 < 1000) Rows Removed by Filter: 9000 - -> Result Cache (actual rows=1 loops=1000) + -> Result Cache (actual rows=1 loops=N) Cache Key: t1.twenty Hits: 980 Misses: 20 Evictions: Zero Overflows: 0 Memory Usage: NkB - -> Index Only Scan using tenk1_unique1 on tenk1 t2 (actual rows=1 loops=20) + -> Index Only Scan using tenk1_unique1 on tenk1 t2 (actual rows=1 loops=N) Index Cond: (unique1 = t1.twenty) Heap Fetches: N (11 rows) @@ -97,23 +101,24 @@ SELECT explain_resultcache(' SELECT COUNT(*),AVG(t1.unique1) FROM tenk1 t1 INNER JOIN tenk1 t2 ON t1.unique1 = t2.thousand WHERE t2.unique1 < 1200;', true); - explain_resultcache ----------------------------------------------------------------------------------------------- - Aggregate (actual rows=1 loops=1) - -> Nested Loop (actual rows=1200 loops=1) - -> Seq Scan on tenk1 t2 (actual rows=1200 loops=1) + explain_resultcache +------------------------------------------------------------------------------------------- + Aggregate (actual rows=1 loops=N) + -> Nested Loop (actual rows=1200 loops=N) + -> Seq Scan on tenk1 t2 (actual rows=1200 loops=N) Filter: (unique1 < 1200) Rows Removed by Filter: 8800 - -> Result Cache (actual rows=1 loops=1200) + -> Result Cache (actual rows=1 loops=N) Cache Key: t2.thousand Hits: N Misses: N Evictions: N Overflows: 0 Memory Usage: NkB - -> Index Only Scan using tenk1_unique1 on tenk1 t1 (actual rows=1 loops=1028) + -> Index Only Scan using tenk1_unique1 on tenk1 t1 (actual rows=1 loops=N) Index Cond: (unique1 = t2.thousand) Heap Fetches: N (11 rows) RESET enable_mergejoin; RESET work_mem; +RESET force_parallel_mode; RESET enable_bitmapscan; RESET enable_hashjoin; -- Test parallel plans with Result Cache. diff --git a/src/test/regress/sql/resultcache.sql b/src/test/regress/sql/resultcache.sql index 2be5b8f2d8..3fede90b00 100644 --- a/src/test/regress/sql/resultcache.sql +++ b/src/test/regress/sql/resultcache.sql @@ -24,6 +24,7 @@ begin ln := regexp_replace(ln, 'Evictions: \d+', 'Evictions: N'); ln := regexp_replace(ln, 'Memory Usage: \d+', 'Memory Usage: N'); ln := regexp_replace(ln, 'Heap Fetches: \d+', 'Heap Fetches: N'); + ln := regexp_replace(ln, 'loops=\d+', 'loops=N'); return next ln; end loop; end; @@ -32,6 +33,9 @@ $$; -- Ensure we get a result cache on the inner side of the nested loop SET enable_hashjoin TO off; SET enable_bitmapscan TO off; +-- force_parallel_mode = regress can cause some instability in EXPLAIN ANALYZE +-- output, so let's ensure that we turn it off. +SET force_parallel_mode TO off; SELECT explain_resultcache(' SELECT COUNT(*),AVG(t1.unique1) FROM tenk1 t1 INNER JOIN tenk1 t2 ON t1.unique1 = t2.twenty @@ -65,6 +69,7 @@ INNER JOIN tenk1 t2 ON t1.unique1 = t2.thousand WHERE t2.unique1 < 1200;', true); RESET enable_mergejoin; RESET work_mem; +RESET force_parallel_mode; RESET enable_bitmapscan; RESET enable_hashjoin;