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 1lQh5q-0006Ul-Nx for pgsql-hackers@arkaria.postgresql.org; Mon, 29 Mar 2021 01:53:26 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lQh5p-0002jF-Il for pgsql-hackers@arkaria.postgresql.org; Mon, 29 Mar 2021 01:53:25 +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 1lQh5p-0002j8-Bz for pgsql-hackers@lists.postgresql.org; Mon, 29 Mar 2021 01:53:25 +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 1lQh5m-00051t-4S for pgsql-hackers@lists.postgresql.org; Mon, 29 Mar 2021 01:53:24 +0000 Received: from hnk.local (p2350207-ipbf2126funabasi.chiba.ocn.ne.jp [114.167.184.207]) by oss.nttdata.com (Postfix) with ESMTPSA id 15FBB625FE; Mon, 29 Mar 2021 10:53:15 +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: Kohei KaiGai Cc: Kazutaka Onishi , Amit Langote , Ibrar Ahmed , Bharath Rupireddy , Zhihong Yu , PostgreSQL Developers , Ashutosh Bapat References: <66da56a4-ed5a-a18f-0f5e-b4d21cda71af@oss.nttdata.com> From: Fujii Masao Message-ID: <14cd2c16-8f95-e163-7797-db939b663ce5@oss.nttdata.com> Date: Mon, 29 Mar 2021 10:53:14 +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=utf-8; 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 9:31, Kohei KaiGai wrote: > Fujii-san, > >> XLOG_HEAP_TRUNCATE record is written even for the truncation of >> a foreign table. Why is this necessary? >> > Foreign-tables are often used to access local data structure, like > columnar data files > on filesystem, not only remote accesses like postgres_fdw. > In case when we want to implement logical replication on this kind of > foreign-tables, > truncate-command must be delivered to subscriber node - to truncate > its local data. > > In case of remote-access FDW drivers, truncate-command on the subscriber-side is > probably waste of cycles, however, only FDW driver and DBA who configured the > foreign-table know whether it is necessary, or not. > > How about your opinions? 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... Regards, -- Fujii Masao Advanced Computing Technology Center Research and Development Headquarters NTT DATA CORPORATION