pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Thomas Kellerer <shammat@gmx.net>
To: Postgres General <pgsql-general@postgresql.org>
Subject: Re: Suggestion: provide a "TRUNCATE PARTITION" command
Date: Fri, 8 Jan 2021 18:12:30 +0100
Message-ID: <5f752f45-67ff-456b-5904-14b1782576bd@gmx.net> (raw)
In-Reply-To: <CAHOFxGqQVsFox-cKx9oT9iEU=5a+bxPvw=8odA2Wxe3NNmapng@mail.gmail.com>
References: <99277f39-f1a1-6da5-176c-3def058cf568@gmx.net>
	<CAHOFxGogGwo14J0r5_BfSDR4=UtH-W48FKOk_3tKDftYFK0j2g@mail.gmail.com>
	<999c4e39-ec8d-35db-f77e-06361861fe4e@gmx.net>
	<CAHOFxGqQVsFox-cKx9oT9iEU=5a+bxPvw=8odA2Wxe3NNmapng@mail.gmail.com>

Michael Lewis schrieb am 08.01.2021 um 17:47:
>      > For me, it seems too easily error prone such that a single typo in
>      > the IN clause may result in an entire partition being removed that
>      > wasn't supposed to be targeted.
>
>     I don't see how this is more dangerous then:
>
>           delete from base_table
>           where partition_key in (...);
>
>     which would serve the same purpose, albeit less efficient.
>
>
> Delete has a rollback option, and you can dry-run to see impacted rows effectively. Truncate does not.

TRUNCATE can be rolled back as well.





view thread (10+ messages)  latest in thread

Message-ID: <5f752f45-67ff-456b-5904-14b1782576bd@gmx.net>
Permalink:  ../5f752f45-67ff-456b-5904-14b1782576bd@gmx.net/
Also on:    postgresql.org/message-id/5f752f45-67ff-456b-5904-14b1782576bd@gmx.net

 · 

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-general@postgresql.org
  Cc: shammat@gmx.net
  Subject: Re: Suggestion: provide a "TRUNCATE PARTITION" command
  In-Reply-To: <5f752f45-67ff-456b-5904-14b1782576bd@gmx.net>
  References: <99277f39-f1a1-6da5-176c-3def058cf568@gmx.net> <CAHOFxGogGwo14J0r5_BfSDR4=UtH-W48FKOk_3tKDftYFK0j2g@mail.gmail.com> <999c4e39-ec8d-35db-f77e-06361861fe4e@gmx.net> <CAHOFxGqQVsFox-cKx9oT9iEU=5a+bxPvw=8odA2Wxe3NNmapng@mail.gmail.com> <5f752f45-67ff-456b-5904-14b1782576bd@gmx.net>

* 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