Re: TRUNCATE on foreign table
Kazutaka Onishi <onishi@heterodb.com>
From: Kazutaka Onishi <onishi@heterodb.com>
To: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Cc: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>,
Zhihong Yu <zyu@yugabyte.com>, PostgreSQL Developers <pgsql-hackers@lists.postgresql.org>,
Kohei KaiGai <kaigai@heterodb.com>
Date: 2021-02-09T14:15:03Z
Lists: pgsql-hackers
> IIUC, "truncatable" would be set to "false" for relations which do not > have physical storage e.g. views but will be true for regular tables. "truncatable" option is just for the foreign table and it's not related with whether it's on a physical storage or not. "postgres_fdw" already has "updatable" option to make the table read-only. However, "updatable" is for DML, and it's not suitable for TRUNCATE. Therefore new options "truncatable" was added. Please refer to this message for details. https://www.postgresql.org/message-id/20200128040346.GC1552%40paquier.xyz > DELETE is very different from TRUNCATE. Application may want to DELETE > based on a join with a local table and hence it can not be executed on > a foreign server. That's not true with TRUNCATE. Yeah, As you say, Applications doesn't need TRUNCATE. We're focusing for analytical use, namely operating huge data. TRUNCATE can erase rows faster than DELETE.
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