Re: NOT IN subquery optimization

From: "Li, Zheng" <zhelli(at)amazon(dot)com>
To: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: NOT IN subquery optimization
Date: 2019-06-18 20:22:30
Message-ID: 61BFFE8C-F884-4936-BB28-0098283F4719@amazon.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

-----
To avoid planning the subquery again later on, I want to keep a pointer of
the subplan in SubLink so that we can directly reuse the subplan when
needed. However, this change breaks initdb for some reason and I'm trying to
figure it out.
-----

"make clean" solved the initdb issue. This new patch keeps a pointer of the subplan
in SubLink so that we can directly reuse the subplan when needed. When the subplan
is not hashable (too big to fit in work_mem), the NOT IN query will be flattened to
an ANTI JOIN and we won't need to use subplan again. However, when the subplan
is hashable, we don't do the conversion and will need to use subplan later, patch v2.1
avoids planning the subquery twice in this case.

-----------
Zheng Li
AWS, Amazon Aurora PostgreSQL

Attachment Content-Type Size
not_in_to_anti_join_transformation_v2_1.patch application/octet-stream 140.9 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2019-06-18 20:33:38 Re: initdb recommendations
Previous Message Andres Freund 2019-06-18 19:18:52 Re: Valgrind failures in Apply Launcher's bgworker_quickdie() exit