Re: TRUNCATE on foreign table

From: Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>
To: Kohei KaiGai <kaigai(at)heterodb(dot)com>
Cc: Kazutaka Onishi <onishi(at)heterodb(dot)com>, Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>, Zhihong Yu <zyu(at)yugabyte(dot)com>, Amit Langote <amitlangote09(at)gmail(dot)com>, Ibrar Ahmed <ibrar(dot)ahmad(at)gmail(dot)com>, PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>
Subject: Re: TRUNCATE on foreign table
Date: 2021-04-13 07:17:12
Message-ID: 2209ecd8-0382-cbcb-5717-15da49535237@oss.nttdata.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2021-04-13 07:26:46 Re: pgsql: Move tablespace path re-creation from the makefiles to pg_regres
Previous Message Tatsuo Ishii 2021-04-13 07:12:59 Re: Retry in pgbench