Remove one memoize test case added by commit 069d0ff02.
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
This commit is contained in:
parent
c39afc38cf
commit
3409b4db63
@ -160,36 +160,6 @@ WHERE s.c1 = s.c2 AND t1.unique1 < 1000;
|
|||||||
1000 | 9.5000000000000000
|
1000 | 9.5000000000000000
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
-- Try with LATERAL references within PlaceHolderVars
|
|
||||||
SELECT explain_memoize('
|
|
||||||
SELECT COUNT(*), AVG(t1.twenty) FROM tenk1 t1 LEFT JOIN
|
|
||||||
LATERAL (SELECT t1.two+t2.two AS c1, t2.unique1 AS c2 FROM tenk1 t2) s ON TRUE
|
|
||||||
WHERE s.c1 = s.c2 AND t1.unique1 < 1000;', false);
|
|
||||||
explain_memoize
|
|
||||||
--------------------------------------------------------------------------------------
|
|
||||||
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
|
|
||||||
-> Memoize (actual rows=1 loops=N)
|
|
||||||
Cache Key: t1.two
|
|
||||||
Cache Mode: binary
|
|
||||||
Hits: 998 Misses: 2 Evictions: Zero Overflows: 0 Memory Usage: NkB
|
|
||||||
-> Seq Scan on tenk1 t2 (actual rows=1 loops=N)
|
|
||||||
Filter: ((t1.two + two) = unique1)
|
|
||||||
Rows Removed by Filter: 9999
|
|
||||||
(12 rows)
|
|
||||||
|
|
||||||
-- And check we get the expected results.
|
|
||||||
SELECT COUNT(*), AVG(t1.twenty) FROM tenk1 t1 LEFT JOIN
|
|
||||||
LATERAL (SELECT t1.two+t2.two AS c1, t2.unique1 AS c2 FROM tenk1 t2) s ON TRUE
|
|
||||||
WHERE s.c1 = s.c2 AND t1.unique1 < 1000;
|
|
||||||
count | avg
|
|
||||||
-------+--------------------
|
|
||||||
1000 | 9.0000000000000000
|
|
||||||
(1 row)
|
|
||||||
|
|
||||||
-- Ensure we do not omit the cache keys from PlaceHolderVars
|
-- Ensure we do not omit the cache keys from PlaceHolderVars
|
||||||
SELECT explain_memoize('
|
SELECT explain_memoize('
|
||||||
SELECT COUNT(*), AVG(t1.twenty) FROM tenk1 t1 LEFT JOIN
|
SELECT COUNT(*), AVG(t1.twenty) FROM tenk1 t1 LEFT JOIN
|
||||||
|
@ -85,17 +85,6 @@ SELECT COUNT(*), AVG(t1.twenty) FROM tenk1 t1 LEFT JOIN
|
|||||||
LATERAL (SELECT t1.two+1 AS c1, t2.unique1 AS c2 FROM tenk1 t2) s ON TRUE
|
LATERAL (SELECT t1.two+1 AS c1, t2.unique1 AS c2 FROM tenk1 t2) s ON TRUE
|
||||||
WHERE s.c1 = s.c2 AND t1.unique1 < 1000;
|
WHERE s.c1 = s.c2 AND t1.unique1 < 1000;
|
||||||
|
|
||||||
-- Try with LATERAL references within PlaceHolderVars
|
|
||||||
SELECT explain_memoize('
|
|
||||||
SELECT COUNT(*), AVG(t1.twenty) FROM tenk1 t1 LEFT JOIN
|
|
||||||
LATERAL (SELECT t1.two+t2.two AS c1, t2.unique1 AS c2 FROM tenk1 t2) s ON TRUE
|
|
||||||
WHERE s.c1 = s.c2 AND t1.unique1 < 1000;', false);
|
|
||||||
|
|
||||||
-- And check we get the expected results.
|
|
||||||
SELECT COUNT(*), AVG(t1.twenty) FROM tenk1 t1 LEFT JOIN
|
|
||||||
LATERAL (SELECT t1.two+t2.two AS c1, t2.unique1 AS c2 FROM tenk1 t2) s ON TRUE
|
|
||||||
WHERE s.c1 = s.c2 AND t1.unique1 < 1000;
|
|
||||||
|
|
||||||
-- Ensure we do not omit the cache keys from PlaceHolderVars
|
-- Ensure we do not omit the cache keys from PlaceHolderVars
|
||||||
SELECT explain_memoize('
|
SELECT explain_memoize('
|
||||||
SELECT COUNT(*), AVG(t1.twenty) FROM tenk1 t1 LEFT JOIN
|
SELECT COUNT(*), AVG(t1.twenty) FROM tenk1 t1 LEFT JOIN
|
||||||
|
Loading…
x
Reference in New Issue
Block a user