mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-09-08 12:49:21 +02:00
2cca95e175
It was possible in cases where we had a LATERAL joined subquery that when the same Var is mentioned in both the lateral references and in the outer Vars of the scan clauses that the given Var wouldn't be assigned to the same NestLoopParam. This could cause issues in Memoize as the cache key would reference the Var for the scan clauses but when the parameter for the lateral references changed some code in Memoize would see that some other parameter had changed that's not part of the cache key and end up purging the entire cache as a result, thinking the cache had become stale. This could result in a Nested Loop -> Memoize plan being quite inefficient as, in the worst case, the cache purging could result in never getting a cache hit. In no cases could this problem lead to incorrect query results. Here we switch the order of operations so that we create NestLoopParam for the lateral references first before doing replace_nestloop_params(). replace_nestloop_params() will find and reuse the existing NestLoopParam in cases where the Var exists in both locations. Author: Richard Guo Reviewed-by: Tom Lane, David Rowley Discussion: https://postgr.es/m/CAMbWs48XHJEK1Q1CzAQ7L9sTANTs9W1cepXu8%3DKc0quUL%2Btg4Q%40mail.gmail.com |
||
---|---|---|
.. | ||
access | ||
archive | ||
backup | ||
bootstrap | ||
catalog | ||
commands | ||
executor | ||
foreign | ||
jit | ||
lib | ||
libpq | ||
main | ||
nodes | ||
optimizer | ||
parser | ||
partitioning | ||
po | ||
port | ||
postmaster | ||
regex | ||
replication | ||
rewrite | ||
snowball | ||
statistics | ||
storage | ||
tcop | ||
tsearch | ||
utils | ||
.gitignore | ||
common.mk | ||
Makefile | ||
meson.build | ||
nls.mk |