public inbox for [email protected]  
help / color / mirror / Atom feed
From: Andrei Lepikhov <[email protected]>
To: Frits Jalvingh <[email protected]>
Cc: [email protected] <[email protected]>
Subject: Re: Question about nested loops..
Date: Fri, 10 Oct 2025 11:28:44 +0200
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAKhTGFW-KL0Fz8z5HrORtLh8YG1as=P1LZhG84U-HQ+ca77Azg@mail.gmail.com>
References: <CAKhTGFURW_AvZgWR20x-kWfSeGts=OWcuOnanhM-dwU9RjiRPw@mail.gmail.com>
	<[email protected]>
	<CAKhTGFW-KL0Fz8z5HrORtLh8YG1as=P1LZhG84U-HQ+ca77Azg@mail.gmail.com>

On 10/10/2025 10:51, Frits Jalvingh wrote:
> Hi Andrei,
> Thanks a lot for your response. I do not fully get it though because the 
> well-performing query also references the outer (external?) relation:
> -> where eenheid.id_h_eenheid = eenheid_s.id_h_eenheid
> But your response made me think a but more.This is the schema of EXPLAIN for the second 'optimal' query:

Seq Scan on s_h_eenheid_ssm D
   SubPlan 2
     ->  Hash Join
           Hash Cond: (A.x = B.x)
           ->  Seq Scan on A
                 Filter: ...
           ->  Hash
                 ->  Hash Join
                       Hash Cond: (C.y = B.x)
                       ->  Seq Scan on s_h_huurovereenkomst_ssm C
                       ->  Hash
                             ->  Seq Scan on s_h_eenheid_ssm B

There is no reference to the upper relation D - each HashJoin refers to 
its left and right side only.

-- regards, Andrei Lepikhov, pgEdge





view thread (3+ messages)

reply

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: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: Question about nested loops..
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox