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 <[email protected]>
Discussion: 
https://postgr.es/m/caaphdvq+atdgbeynxmbbqygji0y3sbtpa4zhynxqb77ufyx...@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 via email to