Re: TRUNCATE on foreign table
Fujii Masao <masao.fujii@oss.nttdata.com>
From: Fujii Masao <masao.fujii@oss.nttdata.com>
To: Kohei KaiGai <kaigai@heterodb.com>
Cc: Kazutaka Onishi <onishi@heterodb.com>,
Amit Langote <amitlangote09@gmail.com>, Ibrar Ahmed <ibrar.ahmad@gmail.com>,
Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>,
Zhihong Yu <zyu@yugabyte.com>,
PostgreSQL Developers <pgsql-hackers@lists.postgresql.org>,
Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Date: 2021-03-29T01:53:14Z
Lists: pgsql-hackers
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
Commits
-
doc: Review for "Allow TRUNCATE command to truncate foreign tables".
- 0c8f40863acb 14.0 landed
-
Don't pass "ONLY" options specified in TRUNCATE to foreign data wrapper.
- 8e9ea08bae93 14.0 landed
-
Support tab-complete for TRUNCATE on foreign tables.
- 81e094bdfdd6 14.0 landed
-
Allow TRUNCATE command to truncate foreign tables.
- 8ff1c94649f5 14.0 landed
-
Add support for asynchronous execution.
- 27e1f14563cf 14.0 cited