pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Fujii Masao <masao.fujii@oss.nttdata.com>
To: Kohei KaiGai <kaigai@heterodb.com>
Cc: Kazutaka Onishi <onishi@heterodb.com>
Cc: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Cc: Zhihong Yu <zyu@yugabyte.com>
Cc: Amit Langote <amitlangote09@gmail.com>
Cc: Ibrar Ahmed <ibrar.ahmad@gmail.com>
Cc: PostgreSQL Developers <pgsql-hackers@lists.postgresql.org>
Cc: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Subject: Re: TRUNCATE on foreign table
Date: Thu, 8 Apr 2021 15:04:57 +0900
Message-ID: <d5df2e94-f643-6409-5cd4-fa1c2ebd41fa@oss.nttdata.com> (raw)
In-Reply-To: <CAOP8fzajfK4vUe0s0YAOehjaFxvcecdvv2JdzeR6mZ-V3fLVbw@mail.gmail.com>
References: <CAJuF6cMWDDqU-vn_knZgma+2GMaout68YUgn1uyDnexRhqqM5Q@mail.gmail.com>
	<CAJuF6cMqL8TzHVJxGTEKL3ijcNW7q5sNnpnjxoc6KJ82TYQRsw@mail.gmail.com>
	<CALj2ACVqVQLw9ysTWP8y2m5Jo2Lh_oxZq_pOR+iAn0k6NqfoKg@mail.gmail.com>
	<CAJuF6cMXJwNophT3PBt_siRt5mX0MHcy-YeCi3zDHJ7vzBMkTw@mail.gmail.com>
	<CALj2ACUFK-Eb-43bHd9NN0GT7sb5NXGqLo9MuL=8L91HoThxUg@mail.gmail.com>
	<CAJuF6cNqsErQ3m4ZF0X0a4owuFxjZ1Msisd-pNDmYwbDNcdwAQ@mail.gmail.com>
	<CALj2ACU3Gtno=FgWhZevwSUivp6kjnnmaf7Mn0Z9=XO9Rsyyjg@mail.gmail.com>
	<CAJuF6cPpG+gZWxbmYXsUZOrvJTaC3FryGasEunj+GLVTKwjR0A@mail.gmail.com>
	<CALj2ACUjKLMjoS9i4dkNc1fP1omKfUysg+Kh4pF5YFGcMJCQpg@mail.gmail.com>
	<CAJuF6cMV8oBTR-1T=5d6g-XQM_mXu+kTwzbY+PeQx4mOr2xbRg@mail.gmail.com>
	<e1d29b4c-0a3d-9e42-9575-a9373b593aa3@oss.nttdata.com>
	<CAOP8fzbDMAS78vD=J183SRXzUJfJgPqudgab++FNRDAS3Eq93w@mail.gmail.com>
	<66e78949-4747-941c-7966-60d9cd1aad99@oss.nttdata.com>
	<CAOP8fzajfK4vUe0s0YAOehjaFxvcecdvv2JdzeR6mZ-V3fLVbw@mail.gmail.com>



On 2021/04/08 13:43, Kohei KaiGai wrote:
> In case when a local table (with no children) has same contents,
> TRUNCATE command
> witll remove the entire table contents.

But if there are local child tables that inherit the local parent table, and TRUNCATE ONLY <parent table> is executed, only the contents in the parent will be truncated. I was thinking that this behavior should be applied to the foreign table whose remote (parent) table have remote child tables.

So what we need to reach the consensus is; how far ONLY option affects. Please imagine the case where we have

(1) local parent table, also foreign table of remote parent table
(2) local child table, inherits local parent table
(3) remote parent table
(4) remote child table, inherits remote parent table

I think that we agree all (1), (2), (3) and (4) should be truncated if local parent table (1) is specified without ONLY in TRUNCATE command. OTOH, if ONLY is specified, we agree that at least local child table (2) should NOT be truncated.

So the remaining point is; remote tables (3) and (4) should be truncated or not when ONLY is specified? You seem to argue that both should be truncated by removing extra list. I was thinking that only remote parent table (3) should be truncated. That is, IMO we should treat the truncation on foreign table as the same as that on its forein data source.

Other people might think neither (3) nor (4) should be truncated in that case because ONLY should affect only the table directly specified in TRUNCATE command, i.e., local parent table (1). For now this also looks good to me.

Regards,

-- 
Fujii Masao
Advanced Computing Technology Center
Research and Development Headquarters
NTT DATA CORPORATION





view thread (117+ messages)  latest in thread

Message-ID: <d5df2e94-f643-6409-5cd4-fa1c2ebd41fa@oss.nttdata.com>
Permalink:  ../d5df2e94-f643-6409-5cd4-fa1c2ebd41fa@oss.nttdata.com/
Also on:    postgresql.org/message-id/d5df2e94-f643-6409-5cd4-fa1c2ebd41fa@oss.nttdata.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: masao.fujii@oss.nttdata.com, kaigai@heterodb.com, onishi@heterodb.com, bharath.rupireddyforpostgres@gmail.com, zyu@yugabyte.com, amitlangote09@gmail.com, ibrar.ahmad@gmail.com, ashutosh.bapat.oss@gmail.com
  Subject: Re: TRUNCATE on foreign table
  In-Reply-To: <d5df2e94-f643-6409-5cd4-fa1c2ebd41fa@oss.nttdata.com>
  References: <CAJuF6cMWDDqU-vn_knZgma+2GMaout68YUgn1uyDnexRhqqM5Q@mail.gmail.com> <CALj2ACVqVQLw9ysTWP8y2m5Jo2Lh_oxZq_pOR+iAn0k6NqfoKg@mail.gmail.com> <CAJuF6cMXJwNophT3PBt_siRt5mX0MHcy-YeCi3zDHJ7vzBMkTw@mail.gmail.com> <CALj2ACUFK-Eb-43bHd9NN0GT7sb5NXGqLo9MuL=8L91HoThxUg@mail.gmail.com> <CAJuF6cNqsErQ3m4ZF0X0a4owuFxjZ1Msisd-pNDmYwbDNcdwAQ@mail.gmail.com> <CALj2ACU3Gtno=FgWhZevwSUivp6kjnnmaf7Mn0Z9=XO9Rsyyjg@mail.gmail.com> <CAJuF6cPpG+gZWxbmYXsUZOrvJTaC3FryGasEunj+GLVTKwjR0A@mail.gmail.com> <CALj2ACUjKLMjoS9i4dkNc1fP1omKfUysg+Kh4pF5YFGcMJCQpg@mail.gmail.com> <CAJuF6cMV8oBTR-1T=5d6g-XQM_mXu+kTwzbY+PeQx4mOr2xbRg@mail.gmail.com> <e1d29b4c-0a3d-9e42-9575-a9373b593aa3@oss.nttdata.com> <CAOP8fzbDMAS78vD=J183SRXzUJfJgPqudgab++FNRDAS3Eq93w@mail.gmail.com> <66e78949-4747-941c-7966-60d9cd1aad99@oss.nttdata.com> <CAOP8fzajfK4vUe0s0YAOehjaFxvcecdvv2JdzeR6mZ-V3fLVbw@mail.gmail.com> <d5df2e94-f643-6409-5cd4-fa1c2ebd41fa@oss.nttdata.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox