Re: Attempting to delete excess rows from table with BATCH DELETE - Mailing list pgsql-general

From Greg Sabino Mullane
Subject Re: Attempting to delete excess rows from table with BATCH DELETE
Date
Msg-id CAKAnmmLhL-kPtMy9+rpwbaOpEi5AsidXzO8_z5-n=iOAG+1ZUA@mail.gmail.com
Whole thread Raw
In response to Re: Attempting to delete excess rows from table with BATCH DELETE  ("David G. Johnston" <david.g.johnston@gmail.com>)
Responses Re: Attempting to delete excess rows from table with BATCH DELETE
List pgsql-general
On Tue, Jan 27, 2026 at 10:31 PM David G. Johnston <david.g.johnston@gmail.com> 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.


Cheers,
Greg

--
Enterprise Postgres Software Products & Tech Support

pgsql-general by date:

Previous
From: Ron Johnson
Date:
Subject: Re: Attempting to delete excess rows from table with BATCH DELETE
Next
From: Gus Spier
Date:
Subject: Re: Attempting to delete excess rows from table with BATCH DELETE