public inbox for [email protected]  
help / color / mirror / Atom feed
From: Feike Steenbergen <[email protected]>
To: Lea Führer <[email protected]>
Cc: [email protected]
Subject: Re: MERGE INTO... WHEN NOT MATCHED BY SOURCE index usage
Date: Wed, 25 Feb 2026 17:35:34 +0100
Message-ID: <CAK_s-G3MKiLACGZqdrg7ZeGYjWPJGXJUSq5erhb4GsXHHy-SuA@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>

On Mon, 23 Feb 2026 at 15:19, Lea Führer <[email protected]> wrote:
> It seems to me like one very common use-case, and one I have bumped into
> often, is to update a n:m resolution table, like this for example:

Something similar was previously discussed in January 2025 as well:

https://www.postgresql.org/message-id/flat/CAK_s-G0NrC_KH7kn85arfqkdzvs80GOCCKvz9YbU2%3DE94qfdPA%40m...

To summarize:

Tom Lane wrote:

> I may not have fully wrapped my head around this example, but I think
> that the fact that "t.device_id = $1" appears in both the ON condition
> and the WHEN NOT MATCHED BY SOURCE condition means that only t rows
> meeting that condition are of interest, so that in principle we could
> optimize by pushing that down to the scan of t.  But as you can see,
> we don't.  Not sure if this pattern is common enough to be worth
> trying to implement such an optimization.

So at least there's 1 more who uses this pattern!

Kind regards

Feike


view thread (2+ 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: MERGE INTO... WHEN NOT MATCHED BY SOURCE index usage
  In-Reply-To: <CAK_s-G3MKiLACGZqdrg7ZeGYjWPJGXJUSq5erhb4GsXHHy-SuA@mail.gmail.com>

* 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