Re: TRUNCATE on foreign table
Michael Paquier <michael@paquier.xyz>
From: Michael Paquier <michael@paquier.xyz>
To: Fujii Masao <masao.fujii@oss.nttdata.com>
Cc: Kohei KaiGai <kaigai@heterodb.com>, 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-29T04:55:34Z
Lists: pgsql-hackers
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. -- Michael
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