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 1lQw5n-00048g-BR for pgsql-hackers@arkaria.postgresql.org; Mon, 29 Mar 2021 17:54:23 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lQw5m-0000Tn-9h for pgsql-hackers@arkaria.postgresql.org; Mon, 29 Mar 2021 17:54:22 +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 1lQw5m-0000Tg-3Q for pgsql-hackers@lists.postgresql.org; Mon, 29 Mar 2021 17:54:22 +0000 Received: from oss.nttdata.com ([49.212.34.109]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lQw5k-0005n1-5X for pgsql-hackers@lists.postgresql.org; Mon, 29 Mar 2021 17:54:21 +0000 Received: from hnk.local (p2350207-ipbf2126funabasi.chiba.ocn.ne.jp [114.167.184.207]) by oss.nttdata.com (Postfix) with ESMTPSA id 8724B628C7; Tue, 30 Mar 2021 02:54:17 +0900 (JST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.102.3 at oss.nttdata.com Subject: Re: TRUNCATE on foreign table To: Michael Paquier Cc: Kohei KaiGai , Kazutaka Onishi , Amit Langote , Ibrar Ahmed , Bharath Rupireddy , Zhihong Yu , PostgreSQL Developers , Ashutosh Bapat References: <66da56a4-ed5a-a18f-0f5e-b4d21cda71af@oss.nttdata.com> <14cd2c16-8f95-e163-7797-db939b663ce5@oss.nttdata.com> From: Fujii Masao Message-ID: Date: Tue, 30 Mar 2021 02:54:17 +0900 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2021/03/29 13:55, Michael Paquier wrote: > On Mon, Mar 29, 2021 at 10:53:14AM +0900, Fujii Masao wrote: >> I understand the motivation of this. But the other DMLs like UPDATE also >> do the same thing for foreign tables? That is, when those DML commands >> are executed on foreign tables, their changes are WAL-logged in a publisher side, >> e.g., for logical replication? If not, it seems strange to allow only TRUNCATE >> on foreign tables to be WAL-logged in a publisher side... > > Executing DMLs on foreign tables does not generate any WAL AFAIK with > the backend core code, even with wal_level = logical, as the DML is > executed within the FDW callback (see just ExecUpdate() or > ExecInsert() in nodeModifyTable.c), and foreign tables don't have an > AM set as they have no physical storage. A FDW may decide to generate > some WAL records by itself though when doing the opeation, using the > generic WAL interface but that's rather limited. > > Generating WAL for the truncation of foreign tables sounds also like a > strange concept to me. I think that you should just make the patch > work so as the truncation is passed down to the FDW that decides what > it needs to do with it, and do nothing more than that. Agreed. Regards, -- Fujii Masao Advanced Computing Technology Center Research and Development Headquarters NTT DATA CORPORATION