pgsql: De-dupicate Memoize cache keys

From: David Rowley <drowley(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: De-dupicate Memoize cache keys
Date: 2024-01-26 07:51:55
Message-ID: E1rTH0F-003Anu-Bt@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

De-dupicate Memoize cache keys

It was possible when determining the cache keys for a Memoize path that
if the same expr appeared twice in the parameterized path's ppi_clauses
and/or in the Nested Loop's inner relation's lateral_vars.  If this
happened the Memoize node's cache keys would contain duplicates.  This
isn't a problem for correctness, all it means is that the cache lookups
will be suboptimal due to having redundant work to do on every hash table
lookup and insert.

Here we adjust paraminfo_get_equal_hashops() to look for duplicates and
ignore them when we find them.

Author: David Rowley
Reviewed-by: Richard Guo
Discussion: https://postgr.es/m/422277.1706207562%40sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/bc397e5cdb31c399392d693cbc5909341d21235a

Modified Files
--------------
src/backend/optimizer/path/joinpath.c | 24 ++++++++++++++++++++----
src/test/regress/expected/memoize.out | 2 +-
2 files changed, 21 insertions(+), 5 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Paquier 2024-01-26 08:40:34 pgsql: Reindex toast before its main relation in reindex_relation()
Previous Message Michael Paquier 2024-01-26 05:09:28 pgsql: Fix comment in index.c