public inbox for [email protected]  
help / color / mirror / Atom feed
db maintanance problem VACUUM FULL
2+ messages / 2 participants
[nested] [flat]

* db maintanance problem VACUUM FULL
@ 2025-06-12 13:14  Pavol Sekeres <[email protected]>
  0 siblings, 1 reply; 2+ messages in thread

From: Pavol Sekeres @ 2025-06-12 13:14 UTC (permalink / raw)
  To: [email protected]

Hi,

We recently updated our production database to PostgreSQL 12.22 from the
9.6.24 version.
We didn't want to make a big jump.
It is around 2 TB in size with one stand-by replica of equal size.
The database is more than 5 years old.

We do run AUTOVACUUM processes on all tables periodically.
We have never run VACUUM FULL on any table.
This is because we can't afford to lock out tables for a long time.

Tables can be more than 100GB in size.
They are being updated daily.
Also due to GDPR old data is erased on a daily basis.
We think these tables might get eventually bloated.

Can this be a problem?

If yes, is there any other solution outside locking the database?
Should we try to solve this problem by creating a logical replica of the
database?
We would then promote the replica to primary.
After that, we would drop the old database.
Is this possible without a big downtime?
Is this even a good idea?

Our database uses a wal_level 'replica'.
As I understand it, this setting would first have to be switched to
'logical'.

Thank you for your answer,
Best regards,
Pavol Sekeres


^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: db maintanance problem VACUUM FULL
@ 2025-06-12 13:26  Ron Johnson <[email protected]>
  parent: Pavol Sekeres <[email protected]>
  0 siblings, 0 replies; 2+ messages in thread

From: Ron Johnson @ 2025-06-12 13:26 UTC (permalink / raw)
  To: pgsql-generallists.postgresql.org <[email protected]>

On Thu, Jun 12, 2025 at 9:14 AM Pavol Sekeres <[email protected]>
wrote:

> Hi,
>
> We recently updated our production database to PostgreSQL 12.22 from the
> 9.6.24 version.
>

Will you soon make another jump to a supported version?


> We didn't want to make a big jump.
> It is around 2 TB in size with one stand-by replica of equal size.
> The database is more than 5 years old.
>
> We do run AUTOVACUUM processes on all tables periodically.
> We have never run VACUUM FULL on any table.
> This is because we can't afford to lock out tables for a long time.
>
> Tables can be more than 100GB in size.
> They are being updated daily.
> Also due to GDPR old data is erased on a daily basis.
> We think these tables might get eventually bloated.
>
> Can this be a problem?
>

What are your autovacuum settings?  If they're aggressive, then no it's not
a problem.


> If yes, is there any other solution outside locking the database?
>

Every weekend, I delete records older than 90 days from 600GB and 300GB
tables.  Because the vacuumdb of the two tables is in bash script that
deletes the old data, and my autovacuum settings are pretty agressive, they
hover around 20% free space right after the purge.

I also disable autovacuum on those tables before the DELETE and enable it
after vacuumdb.

Should we try to solve this problem by creating a logical replica of the
> database?
>

Just to eliminate bloat?


> We would then promote the replica to primary.
> After that, we would drop the old database.
> Is this possible without a big downtime?
> Is this even a good idea?
>
> Our database uses a wal_level 'replica'.
> As I understand it, this setting would first have to be switched to
> 'logical'.
>

-- 
Death to <Redacted>, and butter sauce.
Don't boil me, I'm still alive.
<Redacted> lobster!


^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2025-06-12 13:26 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-06-12 13:14 db maintanance problem VACUUM FULL Pavol Sekeres <[email protected]>
2025-06-12 13:26 ` Ron Johnson <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox