From: David Rowley <drowley@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Remove needless initialization work in ExecInitMemoize
Date: Wed, 11 Nov 2026 02:20:04 +0000
Message-ID: <E1xQxwS-00000000Fnv-0Cdb@gemulon.postgresql.org> (raw)
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@gmail.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(-)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: drowley@postgresql.org
Subject: Re: pgsql: Remove needless initialization work in ExecInitMemoize
In-Reply-To: <E1xQxwS-00000000Fnv-0Cdb@gemulon.postgresql.org>
References: <E1xQxwS-00000000Fnv-0Cdb@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox