pgsql: Don't Memoize lateral joins with volatile join conditions

From: David Rowley <drowley(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Don't Memoize lateral joins with volatile join conditions
Date: 2023-08-07 10:15:41
Message-ID: E1qSxH2-000r5Y-91@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Don't Memoize lateral joins with volatile join conditions

The use of Memoize was already disabled in normal joins when the join
conditions had volatile functions per the code in
match_opclause_to_indexcol(). Ordinarily, the parameterization for the
inner side of a nested loop will be an Index Scan or at least eventually
lead to an index scan (perhaps nested several joins deep). However, for
lateral joins, that's not the case and seq scans can be parameterized
too, so we can't rely on match_opclause_to_indexcol().

Here we explicitly check the parameterization for volatile functions and
don't consider the generation of a Memoize path when such functions
are present.

Author: Richard Guo
Discussion: https://postgr.es/m/CAMbWs49nHFnHbpepLsv_yF3qkpCS4BdB-v8HoJVv8_=Oat0u_w@mail.gmail.com
Backpatch-through: 14, where Memoize was introduced

Branch
------
REL_15_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/71662373b38b838d2e62b353319e93de64ad2036

Modified Files
--------------
src/backend/optimizer/path/joinpath.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)

Browse pgsql-committers by date

  From Date Subject
Next Message David Rowley 2023-08-07 10:16:14 pgsql: Don't Memoize lateral joins with volatile join conditions
Previous Message David Rowley 2023-08-07 10:15:10 pgsql: Don't Memoize lateral joins with volatile join conditions