Skip to content

Commit 3409b4d

Browse files
committed
Remove one memoize test case added by commit 069d0ff.
This test case turns out to depend on the assumption that a non-Var subquery output that's underneath an outer join will always get wrapped in a PlaceHolderVar. But that behavior causes performance regressions in some cases compared to what happened before v16. The next commit will avoid inserting a PHV in the same cases where pre-v16 did, and that causes get_memoized_path to not detect that a memoize plan could be used. Commit this separately, in hopes that we can restore the test after making get_memoized_path smarter. (It's failing to find memoize plans in adjacent cases where no PHV was ever inserted, so there is definitely room for improvement there.) Discussion: https://postgr.es/m/CAG1ps1xvnTZceKK24OUfMKLPvDP2vjT-d+F2AOCWbw_v3KeEgg@mail.gmail.com
1 parent c39afc3 commit 3409b4d

File tree

2 files changed

+0
-41
lines changed

2 files changed

+0
-41
lines changed

src/test/regress/expected/memoize.out

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -160,36 +160,6 @@ WHERE s.c1 = s.c2 AND t1.unique1 < 1000;
160160
1000 | 9.5000000000000000
161161
(1 row)
162162

163-
-- Try with LATERAL references within PlaceHolderVars
164-
SELECT explain_memoize('
165-
SELECT COUNT(*), AVG(t1.twenty) FROM tenk1 t1 LEFT JOIN
166-
LATERAL (SELECT t1.two+t2.two AS c1, t2.unique1 AS c2 FROM tenk1 t2) s ON TRUE
167-
WHERE s.c1 = s.c2 AND t1.unique1 < 1000;', false);
168-
explain_memoize
169-
--------------------------------------------------------------------------------------
170-
Aggregate (actual rows=1 loops=N)
171-
-> Nested Loop (actual rows=1000 loops=N)
172-
-> Seq Scan on tenk1 t1 (actual rows=1000 loops=N)
173-
Filter: (unique1 < 1000)
174-
Rows Removed by Filter: 9000
175-
-> Memoize (actual rows=1 loops=N)
176-
Cache Key: t1.two
177-
Cache Mode: binary
178-
Hits: 998 Misses: 2 Evictions: Zero Overflows: 0 Memory Usage: NkB
179-
-> Seq Scan on tenk1 t2 (actual rows=1 loops=N)
180-
Filter: ((t1.two + two) = unique1)
181-
Rows Removed by Filter: 9999
182-
(12 rows)
183-
184-
-- And check we get the expected results.
185-
SELECT COUNT(*), AVG(t1.twenty) FROM tenk1 t1 LEFT JOIN
186-
LATERAL (SELECT t1.two+t2.two AS c1, t2.unique1 AS c2 FROM tenk1 t2) s ON TRUE
187-
WHERE s.c1 = s.c2 AND t1.unique1 < 1000;
188-
count | avg
189-
-------+--------------------
190-
1000 | 9.0000000000000000
191-
(1 row)
192-
193163
-- Ensure we do not omit the cache keys from PlaceHolderVars
194164
SELECT explain_memoize('
195165
SELECT COUNT(*), AVG(t1.twenty) FROM tenk1 t1 LEFT JOIN

src/test/regress/sql/memoize.sql

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -85,17 +85,6 @@ SELECT COUNT(*), AVG(t1.twenty) FROM tenk1 t1 LEFT JOIN
8585
LATERAL (SELECT t1.two+1 AS c1, t2.unique1 AS c2 FROM tenk1 t2) s ON TRUE
8686
WHERE s.c1 = s.c2 AND t1.unique1 < 1000;
8787

88-
-- Try with LATERAL references within PlaceHolderVars
89-
SELECT explain_memoize('
90-
SELECT COUNT(*), AVG(t1.twenty) FROM tenk1 t1 LEFT JOIN
91-
LATERAL (SELECT t1.two+t2.two AS c1, t2.unique1 AS c2 FROM tenk1 t2) s ON TRUE
92-
WHERE s.c1 = s.c2 AND t1.unique1 < 1000;', false);
93-
94-
-- And check we get the expected results.
95-
SELECT COUNT(*), AVG(t1.twenty) FROM tenk1 t1 LEFT JOIN
96-
LATERAL (SELECT t1.two+t2.two AS c1, t2.unique1 AS c2 FROM tenk1 t2) s ON TRUE
97-
WHERE s.c1 = s.c2 AND t1.unique1 < 1000;
98-
9988
-- Ensure we do not omit the cache keys from PlaceHolderVars
10089
SELECT explain_memoize('
10190
SELECT COUNT(*), AVG(t1.twenty) FROM tenk1 t1 LEFT JOIN

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