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>,
Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>,
Zhihong Yu <zyu@yugabyte.com>, Amit Langote <amitlangote09@gmail.com>,
Ibrar Ahmed <ibrar.ahmad@gmail.com>,
PostgreSQL Developers <pgsql-hackers@lists.postgresql.org>,
Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Date: 2021-04-13T07:17:12Z
Lists: pgsql-hackers
On 2021/04/13 14:22, Kohei KaiGai wrote: > Let me remind the discussion at the design level. > > If postgres_fdw (and other FDW drivers) needs to consider whether > ONLY-clause is given > on the foreign tables of them, what does a foreign table represent in > PostgreSQL system? > > My assumption is, a foreign table provides a view to external data, as > if it performs like a table. > TRUNCATE command eliminates all the segment files, even if a table > contains multiple > underlying files, never eliminate them partially. > If a foreign table is equivalent to a table in SQL operation level, > indeed, ONLY-clause controls > which tables are picked up by the TRUNCATE command, but never controls > which portion of > the data shall be eliminated. So, I conclude that > ExecForeignTruncate() shall eliminate the entire > external data on behalf of a foreign table, regardless of ONLY-clause. > > I think it is more significant to clarify prior to the implementation details. > How about your opinions? I'm still thinking that it's better to pass all information including ONLY clause about TRUNCATE command to FDW and leave FDW to determine how to use them. How postgres_fdw should use the information about ONLY is debetable. But for now IMO that users who explicitly specify ONLY clause for foreign tables understand the structure of remote tables and want to use ONLY in TRUNCATE command issued by postgres_fdw. But my opinion might be minority, so I'd like to hear more opinion about this, from other developers. 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