Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eeu12-0000kK-QI for pgsql-hackers@arkaria.postgresql.org; Fri, 26 Jan 2018 02:45:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eeu11-00075s-GJ for pgsql-hackers@arkaria.postgresql.org; Fri, 26 Jan 2018 02:45:19 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1eeu11-00075e-9p for pgsql-hackers@lists.postgresql.org; Fri, 26 Jan 2018 02:45:19 +0000 Received: from [66.111.4.27] (helo=out3-smtp.messagingengine.com) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1eeu0y-0000ok-7s for pgsql-hackers@postgresql.org; Fri, 26 Jan 2018 02:45:18 +0000 Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 68CF220B1E; Thu, 25 Jan 2018 21:44:54 -0500 (EST) Received: from frontend2 ([10.202.2.161]) by compute7.internal (MEProxy); Thu, 25 Jan 2018 21:44:54 -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:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=SEuofx unzNs3ea8rTF879U1hfbPRgB70G0XgHvTcqdE=; b=T9M/4lcPbgvvbAti0uqovU 7SHMomOlFcDHsQkV1Nhf5jv3SUzJKz6bJympAHnsCfTlcDQExDGp00MSraK+jHcY tk0STLHqXiUTqJuxTzceu01VbWFyiYGysRFn1oHUwXr6uMcevuyHm5laOR6Gmb4s Q2MyJHfMa7o/FyWk6JbmhOKKfhZgjFwQXWfMYzXthasldHqdUquROOC+GBjua9ka 5hHN0O8gJ2OBCqt75iitKBfRrtQ/gOTmbWBwiggNeUW8S+CVtMkQFr+XOfhOpvHb X3bj6BoEPywvpsw9/+MesGQ8VRtXRu8bLqfaiQKbwUjeOXXG1hepn0N7D9zxdQiQ == X-ME-Sender: Received: from april.local (c-73-13-66-39.hsd1.pa.comcast.net [73.13.66.39]) by mail.messagingengine.com (Postfix) with ESMTPA id 1686724434; Thu, 25 Jan 2018 21:44:54 -0500 (EST) Subject: Re: [PATCH] Logical decoding of TRUNCATE To: Petr Jelinek , Marco Nenciarini , Simon Riggs References: <269bf0d2-6ac4-c032-6979-22aad6a9f5fb@2ndquadrant.it> <1a4ace10-1997-6644-d17a-5a17bf250270@2ndquadrant.it> <28a59551-b1f5-8ed4-65cf-76d17e7ee7e6@2ndquadrant.it> <1cb9bd52-9e3a-21bf-0c0c-afa90f463629@2ndquadrant.com> <0361327b-5d59-32b0-cb13-e844acf0f0d0@2ndquadrant.it> <31773cc5-3b29-1740-e7d2-dc48e80a06ce@2ndquadrant.com> <35df4fd5-6b74-9c15-9246-ead8854cc669@2ndquadrant.com> <5462dc00-4941-167e-b287-d7bd9b2283e9@2ndquadrant.com> <3952d6e6-f438-f393-9a02-aae871d2fc3e@2ndquadrant.com> Cc: PostgreSQL-development From: Peter Eisentraut Organization: 2ndQuadrant Message-ID: <7f0589c2-c82e-27f3-9d2c-68c0a1bb0b6e@2ndquadrant.com> Date: Thu, 25 Jan 2018 21:44:53 -0500 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <3952d6e6-f438-f393-9a02-aae871d2fc3e@2ndquadrant.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Host-Lookup-Failed: Reverse DNS lookup failed for 66.111.4.27 (deferred) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 1/24/18 07:53, Petr Jelinek wrote: > That depends on if we consider this to be part of sequence handling or > truncate statement replication handling. It's true that if we had > sequence replication, the restart would get propagated that way anyway. > OTOH, if we'll want to add option in the future to propagate cascade (to > any additional tables on downstream), it may need to reset sequences > which are not even present upstream and as such would not be handled by > sequence replication. Logical replication, as it currently is designed, replicates discrete actions, not commands. A delete command that deletes five rows and cascades to delete three more rows somewhere else ends up being replicated as eight changes. So I think a TRUNCATE command that cascades to four tables and resets six sequences should end up being replicated as ten changes. (Since we currently don't handle sequences at all, we'll omit the six sequence changes for now.) -- Peter Eisentraut http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services