From: Frédéric Yhuel <frederic.yhuel@dalibo.com>
To: Jerry Brenner <jbrenner@guidewire.com>
Cc: pgsql-performance@lists.postgresql.org
Subject: Re: Which side of a Merge Join gets executed first? Do both sides always get executed?
Date: Thu, 21 Dec 2023 07:27:20 +0100
Message-ID: <1834c776-cd1d-4669-89d9-5fb816acfd08@dalibo.com> (raw)
In-Reply-To: <CACoKFYQ8UH+SNuo9JaAmXeg6Z6GJiqy0xEYGbEjqnDYf6N7NoQ@mail.gmail.com>
References: <CACoKFYQLgfOYnEGKytSZOQ7hrpdcGgk0jn22jRsZCU9aChUnCw@mail.gmail.com>
<e7791357-4f29-4396-8419-daa14cbd52c6@dalibo.com>
<CACoKFYQ8UH+SNuo9JaAmXeg6Z6GJiqy0xEYGbEjqnDYf6N7NoQ@mail.gmail.com>
Le 20/12/2023 à 20:04, Jerry Brenner a écrit :
> Thanks. Does this make sense?
>
> * There are 3 nodes under the Merge Join
> * The first node is an InitPlan, due to the ANY(ARRAY()) - that gets
> executed and finds 0 matching rows
> * The second node is the outer node in the Merge Join and that is the
> expensive node in our query plan
> * The third node is the inner node in the Merge Join and that node
> references the SubPlan generated by the first node. The IndexCond
> has*"id = ANY($2) AND ..."* and the comparison with the result of
> the SubPlan does not find a match, so that's where the
> short-circuiting happens.
I think it does.
I'm not very experienced with the customs of these mailing lists, but I
think the following would help to get more answers :
* TEXT format of EXPLAIN is much more readable (compared to JSON)
* A well formatted query would help
* Screenshots aren't so great
Rather than a screenshot, maybe you could use one of explain.depesz.com,
explain.dalibo.com, or explain-postgresql.com ?
Best regards,
Frédéric
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 using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: frederic.yhuel@dalibo.com, jbrenner@guidewire.com, pgsql-performance@lists.postgresql.org
Subject: Re: Which side of a Merge Join gets executed first? Do both sides always get executed?
In-Reply-To: <1834c776-cd1d-4669-89d9-5fb816acfd08@dalibo.com>
* 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