public inbox for [email protected]
help / color / mirror / Atom feedFrom: Ron Johnson <[email protected]>
To: pgsql-general <[email protected]>
Subject: Re: Attempting to delete excess rows from table with BATCH DELETE
Date: Wed, 28 Jan 2026 10:57:22 -0500
Message-ID: <CANzqJaCTto6Sd+vi_g=empKWfd0c0KBw2SUE98koMF2OMcvd3A@mail.gmail.com> (raw)
In-Reply-To: <CAKAnmmLhL-kPtMy9+rpwbaOpEi5AsidXzO8_z5-n=iOAG+1ZUA@mail.gmail.com>
References: <CAG8xnif_jmRYAGUvtoQNsHA8UqGRDkwuSffO55-3wGMLQArA8g@mail.gmail.com>
<CAKFQuwa96OCxiW5yLtnUVvN1U4208o9c3NvLxnL1MkojLhQcVg@mail.gmail.com>
<CAKAnmmLhL-kPtMy9+rpwbaOpEi5AsidXzO8_z5-n=iOAG+1ZUA@mail.gmail.com>
On Wed, Jan 28, 2026 at 10:39 AM Greg Sabino Mullane <[email protected]>
wrote:
> On Tue, Jan 27, 2026 at 10:31 PM David G. Johnston <
> [email protected]> wrote:
>
>> Strongly encourage you to try to accomplish your goal without any delete
>> commands at that scale that causes vacuuming. Can you just create an empty
>> copy and load the data to keep into it then point at the newly filled
>> database? Truncate is OK.
>>
>
> This is really the best solution, especially if most of the rows are > 75
> days old. This removes 100% of your bloat, allows you to keep the old data
> around in case something goes wrong, reduces WAL compared to massive
> deletes, and removes the need to mess with autovacuum.
>
Looping DELETE is the Dirt Simple option when the application is writing
24x7, when there's a lot of FK dependencies, etc. It also allows you to
throttle the process (bash sleep between DELETE statements, or only purging
a few old days per script execution and then only run the script at night).
--
Death to <Redacted>, and butter sauce.
Don't boil me, I'm still alive.
<Redacted> lobster!
view thread (3+ messages)
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 using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected]
Subject: Re: Attempting to delete excess rows from table with BATCH DELETE
In-Reply-To: <CANzqJaCTto6Sd+vi_g=empKWfd0c0KBw2SUE98koMF2OMcvd3A@mail.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 agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox