Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mlb3w-0000Nv-Jc for pgsql-hackers@arkaria.postgresql.org; Fri, 12 Nov 2021 18:14:08 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mlb3v-0008Fr-JO for pgsql-hackers@arkaria.postgresql.org; Fri, 12 Nov 2021 18:14:07 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mlb3v-0008Fi-AB for pgsql-hackers@lists.postgresql.org; Fri, 12 Nov 2021 18:14:07 +0000 Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mlb3r-0004nt-RL for pgsql-hackers@lists.postgresql.org; Fri, 12 Nov 2021 18:14:06 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id DFA515C0A64; Fri, 12 Nov 2021 13:14:01 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Fri, 12 Nov 2021 13:14:01 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=97cPP3V91o4YBn+womBekh2UGCkhmVaLB4CPZrlVXYk=; b=CYl7GCeG DIdu5es+I+FjIHWERFXiwl1tpsGA9cMfFMUYQoZ8SYYrzLr88kRnMQWuanTv8gR1 3gfOU9RxC6lgxpijk/qOHq4q27hBwxa1ap1Um27QK+OT8EywimpC38DlzFh1EG9E aBQncB/IieJxBEmG1gvbt0wUt/WkFBMyUz/IOZmsOZSbT0mWoOmDLkdDmB5KD6s4 JLo6NdLzBLRiShLmrS0XEIZJQtpv2V0msrZdj4ksG7vJXTM56QKFolKcx1b6wipN qjScQqaOelI6lnqK4ETpjNTUR6CNbiIFVxSdrn3i4KdMM/m0ZrBD36beVLhP49yZ gCqN02LoFXEtLg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvuddrvdefgddutdejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfggtggugfgjsehtkeertddttdejnecuhfhrohhmpeetlhhvrghr ohcujfgvrhhrvghrrgcuoegrlhhvhhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorhhgqe enucggtffrrghtthgvrhhnpedujeevjeffjeevuddutedvkeeiueeitddvieelfeekveej udefgeeuvdejhfeuleenucffohhmrghinhepvghnthgvrhhprhhishgvuggsrdgtohhmne cuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprghlvhhh vghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 12 Nov 2021 13:14:01 -0500 (EST) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id EA1552A07B8; Fri, 12 Nov 2021 15:13:58 -0300 (-03) Date: Fri, 12 Nov 2021 15:13:58 -0300 From: Alvaro Herrera To: Tomas Vondra Cc: Pg Hackers Subject: Re: support for MERGE Message-ID: <202111121813.44jbkflr7kgn@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <3f45ed11-8b55-70f0-0c01-ff863313d0d1@enterprisedb.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2021-Nov-12, Tomas Vondra wrote: > On 11/12/21 18:57, Alvaro Herrera wrote: > > Secondarily, and I'm now not sure that I really want to do it, is change > > the representation for executor: instead of creating a fake join between > > target and source, perhaps we should have just source, and give > > optimizer a separate query to fetch tuples from target. > > When you say you're not sure you want to change this, is that because you > don't have time for that, or because you think the current approach is > better? I'm not sure that doing it the other way will be better. We'll have two queries to optimize: one is reading from the data source, and the other is fetching tuples from the target table based on the conditions applied to each row obtained form the data source. Right now, we just apply a join and let the optimizer do it's thing. It's simpler, but ... -- Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/