public inbox for [email protected]  
help / color / mirror / Atom feed
From: Laurenz Albe <[email protected]>
To: Pavol Sekeres <[email protected]>
To: [email protected]
Subject: Re: db maintanance problem VACUUM FULL
Date: Thu, 12 Jun 2025 15:24:11 +0200
Message-ID: <[email protected]> (raw)
In-Reply-To: <CA+RPunpqzys-rqsH9Xia8KWJ2+mR=V_TXe4Ca+JDV7bvmym8TQ@mail.gmail.com>
References: <CA+RPunpqzys-rqsH9Xia8KWJ2+mR=V_TXe4Ca+JDV7bvmym8TQ@mail.gmail.com>

On Thu, 2025-06-12 at 15:14 +0200, Pavol Sekeres wrote:
> 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.

But you should have.  v12 is out of support.

> It is around 2 TB in size with one stand-by replica of equal size.
> 
> 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?

Yes.
Check for bloat in suspicious tables using the "pgstattuple" extension.

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

There are the third-party tools pg_squeeze and pg_repack.

> 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?

Yes, that is possible.

> Is this even a good idea?

Logical replication can be complicated.  One of the above tools would be simpler.

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

Right.

Yours,
Laurenz Albe






view thread (2+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: db maintanance problem VACUUM FULL
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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