pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Rob Sargent <robjsargent@gmail.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: Effects of dropping a large table
Date: Tue, 18 Jul 2023 13:41:40 -0600
Message-ID: <7e97caed-e625-867d-a4f9-8512c8db3421@gmail.com> (raw)
In-Reply-To: <CANi9rAN7vm7-+qAK6Sasa_S69y2OWZBqQ3Fksx3dMmRLBRDLBA@mail.gmail.com>
References: <CANi9rAN7vm7-+qAK6Sasa_S69y2OWZBqQ3Fksx3dMmRLBRDLBA@mail.gmail.com>

On 7/18/23 11:58, Devin Ivy wrote:
> Hi all,
> I'm hoping to ensure I understand the implications of dropping a large 
> table and the space being reclaimed by the database and/or OS.  We're 
> using pg v14.
>
> This table is quite large with a primary key and one additional 
> index—all together these are on the order of 1TB. The primary key and 
> index take-up quite a bit more space than the table itself.  Our hope 
> is to discontinue use of this table and then eventually drop it.  
> However, the database is under constant load and we'd like to avoid 
> (or at least anticipate) downtime or degraded performance.  The 
> database also replicates to a standby instance.
>
> So in short, what can we expect if we drop this table? Will the 
> strategy that pg takes to give that space back to the rest of the 
> database and/or OS have significant effects on availability or 
> performance?  Finally, are there any other considerations that we 
> should take into account?  I appreciate your time and input, thanks!
>
> --
> Devin Ivy
You might consider deleting portions of the table in separate 
(consecutive) batches (maybe 5% per delete).  And then truncate table is 
not logged so that might be an alternative.

view thread (10+ messages)  latest in thread

Message-ID: <7e97caed-e625-867d-a4f9-8512c8db3421@gmail.com>
Permalink:  ../7e97caed-e625-867d-a4f9-8512c8db3421@gmail.com/
Also on:    postgresql.org/message-id/7e97caed-e625-867d-a4f9-8512c8db3421@gmail.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-general@postgresql.org
  Cc: robjsargent@gmail.com
  Subject: Re: Effects of dropping a large table
  In-Reply-To: <7e97caed-e625-867d-a4f9-8512c8db3421@gmail.com>
  References: <CANi9rAN7vm7-+qAK6Sasa_S69y2OWZBqQ3Fksx3dMmRLBRDLBA@mail.gmail.com> <7e97caed-e625-867d-a4f9-8512c8db3421@gmail.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