Re: Purging few months old data and vacuuming in production

From: Ron <ronljohnsonjr(at)gmail(dot)com>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Purging few months old data and vacuuming in production
Date: 2023-01-07 13:40:01
Message-ID: a4199207-a5dc-583a-5782-67e1ab8f57c8@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
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.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Zheng Li 2023-01-07 15:28:11 Re: Support logical replication of DDLs
Previous Message Peter J. Holzer 2023-01-07 11:29:46 Re: Purging few months old data and vacuuming in production