Re: Unexpected Seq Scan's when using MERGE WHEN NOT MATCHED BY SOURCE

From: Viktor Holmberg <v(at)viktorh(dot)net>
To: Feike Steenbergen <feikesteenbergen(at)gmail(dot)com>, David Mullineux <dmullx(at)gmail(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Unexpected Seq Scan's when using MERGE WHEN NOT MATCHED BY SOURCE
Date: 2026-04-29 11:47:07
Message-ID: fffd3a77-f9cb-44e5-91ea-11d6216f3f14@Spark
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Apologies for the necromancer here but just chiming in that I also got bitten by this in our production systems today. It’s precisely the same pattern - MERGEing into a “part” of a table. Would be nice if MERGE allowed you to specify a “filter” or something so it only affected a subsection of the table - but Toms suggestion of pushing down the condition would also have saved me. For now I’m just going to have to abandon the MERGE construct and go back to separate INSERT and DELETE’s.

/Viktor

In response to

Browse pgsql-performance by date

  From Date Subject
Previous Message Laurenz Albe 2026-04-28 05:33:24 Re: Query performance