Re: Options for more aggressive space reclamation in vacuuming? - Mailing list pgsql-admin

From Laurenz Albe
Subject Re: Options for more aggressive space reclamation in vacuuming?
Date
Msg-id 70d586af88aa7365670cd75a826784554c5ce816.camel@cybertec.at
Whole thread Raw
In response to Re: Options for more aggressive space reclamation in vacuuming?  (Wells Oliver <wells.oliver@gmail.com>)
List pgsql-admin
On Sun, 2023-05-14 at 14:02 -0700, Wells Oliver wrote:
> I think our use-case here is nothing special: just very large tables that are deleted
> from and re-inserted with some frequency. They store monthly data and exist as partitions.
> As an example, July of 2022 (summer months are peak) had 1,630,558,336 rows. We delete
> from this and insert daily. We rarely get new, relevant data once the month is over.
> The n_dead_tup from pg_stat_all_tables here was over 7m rows, and clearing that out
> gave us back nearly 50GB, and the file size estimate on this partition was ~200 GB.
> These tables get auto-vacuumed but clearly it's not, well, aggressively reclaiming space.

As a rule, normal VACUUM will not reclaim space at all (only if after the run, the last
pages of a tabel are empty).  That's why you use range partitioning.  Simply drop the
partition that is expired.  Ideally, you wouldn't go to the trouble of deleting data at all.

Yours,
Laurenz Albe



pgsql-admin by date:

Previous
From: Ron
Date:
Subject: Re: how do I capture conflicting rows
Next
From: Alvaro Herrera
Date:
Subject: Re: how do I capture conflicting rows