strange slow query - lost lot of time somewhere

Pavel Stehule <pavel.stehule@gmail.com>

From: Pavel Stehule <pavel.stehule@gmail.com>
To: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2022-05-02T08:59:33Z
Lists: pgsql-hackers
Hi

I found a query that is significantly slower with more memory

plan 1 - fast https://explain.depesz.com/s/XM1f

plan 2 - slow https://explain.depesz.com/s/2rBw

Strange - the time of last row is +/- same, but execution time is 10x worse

It looks like slow environment cleaning

Commits

  1. Correct Memoize's estimated cache hit ratio calculation

  2. Fix incorrect row estimates used for Memoize costing

  3. Allow Memoize to operate in binary comparison mode