pgsql: Remove needless initialization work in ExecInitMemoize

From: David Rowley <drowley(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Remove needless initialization work in ExecInitMemoize
Date: 2026-11-11 02:20:04
Message-ID: E1xQxwS-00000000Fnv-0Cdb@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Remove needless initialization work in ExecInitMemoize

When a Memoize node is in binary mode, cache keys are hashed with
datum_image_hash() and compared with datum_image_eq(). Despite that,
ExecInitMemoize() always looked up the hash functions for each cache
key and built cache_eq_expr, neither of which binary mode uses.

Only do that work when not in binary mode. This saves some executor
startup work and memory for Memoize nodes using binary mode.

Discovered while studying code for bug #19853.

In passing, adjust comment that mentioned "type's hash equality operator",
per changes done in 8cdf3c921.

Author: David Rowley <dgrowleyml(at)gmail(dot)com>
Discussion: https://postgr.es/m/CAApHDvq+atDgBEYnxMBbQyGji0y3sBtpa4zhYnXqb77UfyxzMA@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/76c0df7381e5e4d3fba06abddcb51216821c02bc

Modified Files
--------------
src/backend/executor/nodeMemoize.c | 70 +++++++++++++++++++++++---------------
1 file changed, 42 insertions(+), 28 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Amit Langote 2026-11-11 06:05:20 pgsql: SQL/JSON: Fix PASSING of string types other than text and varcha
Previous Message Michael Paquier 2026-11-11 01:39:36 pgsql: pg_dump: Fix inherited flag in extended stats from pre-v15 serve