Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uPhxE-00E6mc-0V for pgsql-general@arkaria.postgresql.org; Thu, 12 Jun 2025 13:26:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1uPhxC-00CkwJ-4t for pgsql-general@arkaria.postgresql.org; Thu, 12 Jun 2025 13:26:50 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uPhxB-00CkuC-P3 for pgsql-general@lists.postgresql.org; Thu, 12 Jun 2025 13:26:50 +0000 Received: from mail-oi1-x236.google.com ([2607:f8b0:4864:20::236]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1uPhxA-001dyZ-1P for pgsql-general@lists.postgresql.org; Thu, 12 Jun 2025 13:26:50 +0000 Received: by mail-oi1-x236.google.com with SMTP id 5614622812f47-408fa4be483so561375b6e.0 for ; Thu, 12 Jun 2025 06:26:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1749734806; x=1750339606; darn=lists.postgresql.org; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=bFuvmlYEhDpHCrJjfJ7w4k0HvG397ZTVq8xy8I8CSaI=; b=iPchF6mx6D0r46e63pmaZ98LlUhaBKvFi4mxbg6UkVL2/Dp7jDAhBKgeD/daCz5BA5 TWDVroaOYFrBZE7f6PzAhe4LDyKLyEBkzHshxljPma0hC569/IVRxI3sNfTug4v+Xkll hTA5ZWSk3SXPPGmqam0UiYDv3BD7Nfwha240VwQmAQYTt87u56cNKVERm9bW1GQztLFY aEjL8Ck9Wd+C+2H2YnGRqI9UBcs3vwKUnxgpKpCr68M8CpTiqW1/vTvudAkac8RwAXYx IqYiSy5SQJBJsAbYQ92viKomZsjSORcDpJLkoTrXAtCvIMqrAfVf1BLf0XqH9PUUhEzq sIdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749734806; x=1750339606; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=bFuvmlYEhDpHCrJjfJ7w4k0HvG397ZTVq8xy8I8CSaI=; b=ImuxPCbEtz/0Mm398zK41UsHy722Iv9+AHK4yaKuVr6ShFnUhYm6RyswIj3SsxgCz7 r7ECFFbLOQUesOfpMOyIIvzjI2xUXIkCrLOYEmg8cB5fIhGNg4V1soXplL1AGyBYkPZt BxdJoF2fY74BBOD02xbrIB/iiofqLzT5nYOL6mnHqROICW9WUav0iAPfm2k4/UaPzVja ewCaPzV7XMoABCmGDLjeGN7IqXuvzrivpC1PUCoSgZcOJTGXIPdK/2eP8BLxeuiOCsjw hDeDlO0wP+FBWw6e85bldGnus2i0pI8mCY78cH3ZySeW/f1zXvPPdcJ7u2JRXDU4Im75 tYBg== X-Gm-Message-State: AOJu0Yz98G0O76teZqsRrO3f7R+YVWAJq257OGn/tfUatOgyfio2gthR czMBQNZcTHTwM2a1eDDmEvJzwDIlro/jB9LSI/ZNafxYkpoBnlLvsTWEFaeenNLalyjqciXq75x 1CRdecfzUYL76dEvnfOebwGFI+CbvmkszVA== X-Gm-Gg: ASbGncs46KZPxKffNxdeOSq7HOo4Kf/ANeDkNNJtGAUeG628yjyLuP8kfwgIyEWZYdb jPDd8ptjdHUW4zN4+zjXXqc4MgY8kaHLtkBhe4hC2sQS9+GsHex0LF0rgYQKpJOhxYh3f8GdtQs /dC6UKeg1N22ZbLVhPhmN/nl2QnhtktOHka8v0QH9DeLDk X-Google-Smtp-Source: AGHT+IE2VSImd5xpSOtxvAqczBbDUxSWLvbIDVWGi6M7tRsnG47GyEq5iDjaiqvqabsTfdb8nCFitYvNffSHz3UJfCA= X-Received: by 2002:a05:6808:13c9:b0:40a:52e5:37df with SMTP id 5614622812f47-40a66b686b2mr2000591b6e.39.1749734806279; Thu, 12 Jun 2025 06:26:46 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Ron Johnson Date: Thu, 12 Jun 2025 09:26:34 -0400 X-Gm-Features: AX0GCFt06m52mPg9wSfEf25ZMgPdweKUZy0PGHA1ggdnVZ3WnimbvXsYtXjSQkY Message-ID: Subject: Re: db maintanance problem VACUUM FULL To: "pgsql-generallists.postgresql.org" Content-Type: multipart/alternative; boundary="000000000000945e3406375fe1aa" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000945e3406375fe1aa Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Jun 12, 2025 at 9:14=E2=80=AFAM Pavol Sekeres 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'. > --=20 Death to , and butter sauce. Don't boil me, I'm still alive. lobster! --000000000000945e3406375fe1aa Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Thu, Jun 12, 2025 at 9:14=E2=80=AFAM P= avol Sekeres <pavol.sekeres8= @gmail.com> wrote:
Hi,=

We recently updated our production database to PostgreS= QL 12.22 from the 9.6.24 version.

Will you soon make another jump to a supported version?
=C2=A0=
We didn't want to make a big jump.
It is around 2 TB in si= ze 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 FU= LL on any table.
This is because we can't afford to lock out = tables for a long time.

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

Can this be a problem= ?

What are your autovacuum sett= ings?=C2=A0 If they're aggressive, then no it's not a problem.
=C2=A0
If yes, is there any other solution outside locking the data= base?

Every weekend, I delete r= ecords older than 90 days from 600GB and 300GB tables.=C2=A0 Because the va= cuumdb of the two tables is in bash script that deletes the old data, and m= y autovacuum settings are pretty agressive, they hover around 20% free spac= e right after the purge.
=C2=A0
I also disable autovacu= um 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 elimin= ate bloat?
=C2=A0
We would then promote the replica to primary.=
After that, we would drop the old database.
Is th= is 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 switche= d to 'logical'.
=C2=A0
--
Death to <Redacted>, and butter sau= ce.
Don't boil me, I'm still alive.
<Redacted&g= t; lobster!
--000000000000945e3406375fe1aa--