Re: TRUNCATE on foreign table - Mailing list pgsql-hackers

From Fujii Masao
Subject Re: TRUNCATE on foreign table
Date
Msg-id 2209ecd8-0382-cbcb-5717-15da49535237@oss.nttdata.com
Whole thread Raw
In response to Re: TRUNCATE on foreign table  (Kohei KaiGai <kaigai@heterodb.com>)
Responses Re: TRUNCATE on foreign table  (Kyotaro Horiguchi <horikyota.ntt@gmail.com>)
Re: TRUNCATE on foreign table  (Kohei KaiGai <kaigai@heterodb.com>)
List 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



pgsql-hackers by date:

Previous
From: Tatsuo Ishii
Date:
Subject: Re: Retry in pgbench
Next
From: Michael Paquier
Date:
Subject: Re: pgsql: Move tablespace path re-creation from the makefiles to pg_regres