Re: Purging few months old data and vacuuming in production

Ron <ronljohnsonjr@gmail.com>

From: Ron <ronljohnsonjr@gmail.com>
To: pgsql-general@lists.postgresql.org
Date: 2023-01-07T13:40:01Z
Lists: pgsql-general
On 1/7/23 05:29, Peter J. Holzer wrote:
[snip]
> If I understood correctly, you have to delete about 3 million records
> (worst case) from the main table each day. Including the other 8 tables
> those are 27 million DELETE queries each of which deletes only a few
> records. That's about 300 queries per second. I'd be worried about
> impacting performance on other queries at this rate.

300 *records*/second.  Fewer DELETE statements if there are one-many 
relationships with the child tables.

> I'd go for a middle ground: Instead of expiring once per day, use a
> shorter interval, maybe once per hour or once per minute. That will
> (probably) make each expire job really quick but still create much less
> load overall.

-- 
Born in Arizona, moved to Babylonia.