Re: Memoize ANTI and SEMI JOIN inner

Richard Guo <guofenglinux@gmail.com>

From: Richard Guo <guofenglinux@gmail.com>
To: Andres Freund <andres@anarazel.de>
Cc: David Rowley <dgrowleyml@gmail.com>, Andrei Lepikhov <lepihov@gmail.com>, PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2025-05-14T02:13:56Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Enable use of Memoize for ANTI joins

Attachments

On Tue, May 13, 2025 at 10:51 PM Andres Freund <andres@anarazel.de> wrote:
> This is failing on CI:
> https://cirrus-ci.com/github/postgresql-cfbot/postgresql/cf%2F5636
> https://api.cirrus-ci.com/v1/artifact/task/5411026402803712/testrun/build-32/testrun/regress/regress/regression.diffs
>
> diff -U3 /tmp/cirrus-ci-build/src/test/regress/expected/memoize.out /tmp/cirrus-ci-build/build-32/testrun/regress/regress/results/memoize.out
> --- /tmp/cirrus-ci-build/src/test/regress/expected/memoize.out  2025-04-12 11:24:10.866868945 +0000
> +++ /tmp/cirrus-ci-build/build-32/testrun/regress/regress/results/memoize.out   2025-04-12 11:32:44.454864476 +0000
> @@ -525,7 +525,7 @@
>                       ->  Unique (actual rows=2.67 loops=N)
>                             ->  Sort (actual rows=67.33 loops=N)
>                                   Sort Key: t2_1.a
> -                                 Sort Method: quicksort  Memory: 27kB
> +                                 Sort Method: quicksort  Memory: 18kB
>                                   ->  Seq Scan on tab_anti t2_1 (actual rows=100.00 loops=N)
>  (15 rows)
>
>
> There shouldn't be Memory mentioned in tests added to the tree.

Thanks for pointing this out.  You're right — Memory usage should be
hidden from the output of EXPLAIN ANALYZE.  I'm a bit surprised the
existing explain_memoize function doesn't already handle that; I
guess it's because the plans in memoize.sql don't currently include
any Sort nodes.  In any case, I've added a regexp_replace to filter
out 'Memory: \d+kB' in explain_memoize.

Thanks
Richard