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 1sbmLg-001Mc4-Up for pgsql-admin@arkaria.postgresql.org; Wed, 07 Aug 2024 19:29:28 +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 1sbmLe-009Rue-P3 for pgsql-admin@arkaria.postgresql.org; Wed, 07 Aug 2024 19:29:26 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sbmLe-009RuW-CP for pgsql-admin@lists.postgresql.org; Wed, 07 Aug 2024 19:29:26 +0000 Received: from qs51p00im-qukt01080502.me.com ([17.57.155.23]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sbmLb-003acq-J7 for pgsql-admin@lists.postgresql.org; Wed, 07 Aug 2024 19:29:25 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=1a1hai; t=1723058961; bh=+nzFxcrMcAPQtXtpQZ0Bvi6U6T+buxmUdR1yotM78AY=; h=From:Message-Id:Content-Type:Mime-Version:Subject:Date:To; b=ACuZpmE2qY+I9sAnZPCTjId6iV5hcHef3Hdx5/T538t+Ct8OF0Cjdp7YjDurPGm+E POEg9yNcbb0k2WgWgE4Nl8Z3Hx/l/AfszTjCsLelkMEuY6v9DEUwd6RllzZxVuO6NG 1HUmC08NfIhQZUxRWnR0HVO5fmm8rTDK/aF3KxtQ8PRrciS7Pn69im5pJF4kSaLNbR DgQG0KB0s7dAg5VBEVWEBXqjbHABXkHguOqmzNHtoVadwFt4mqvt/JKNiHJmxiKgIE iRakp+xpTuLcXSq3dpIin6hRmqejtYt8Etk9e4eDVPnEPW/Ctd+sn/9GpueAR9D9E4 vXHs+7Tye1q0g== Received: from smtpclient.apple (qs51p00im-dlb-asmtp-mailmevip.me.com [17.57.155.28]) by qs51p00im-qukt01080502.me.com (Postfix) with ESMTPSA id 646B54E401F6; Wed, 7 Aug 2024 19:29:19 +0000 (UTC) From: Rui DeSousa Message-Id: <69C14B4B-0DED-442A-BD74-3CABA4DD64BD@icloud.com> Content-Type: multipart/alternative; boundary="Apple-Mail=_7030AABF-5F10-4F07-8177-63EAD713DA5F" Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.8\)) Subject: Re: Schedule pg_repack job with pg_cron Date: Wed, 7 Aug 2024 15:29:15 -0400 In-Reply-To: Cc: Sathish Reddy , pgsql-admin@lists.postgresql.org, Keith , keith.fiske@crunchydata.com, Laurenz Albe To: jacob ndinkwa References: X-Mailer: Apple Mail (2.3696.120.41.1.8) X-Proofpoint-GUID: tArncH4-P_n--cqRS3aFuN8EglFDOL21 X-Proofpoint-ORIG-GUID: tArncH4-P_n--cqRS3aFuN8EglFDOL21 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-08-07_11,2024-08-07_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 malwarescore=0 phishscore=0 mlxscore=0 adultscore=0 mlxlogscore=999 clxscore=1011 suspectscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2308100000 definitions=main-2408070136 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --Apple-Mail=_7030AABF-5F10-4F07-8177-63EAD713DA5F Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Aug 7, 2024, at 9:24 AM, jacob ndinkwa wrote: >=20 > To schedule a pg_repack job using pg_cron on an Amazon RDS for = PostgreSQL instance, you need to follow a few steps. However, it=E2=80=99s= important to note that pg_cron is only supported on certain versions of = Amazon RDS, and pg_repack is also a separate extension that must be = installed and enabled. >=20 >=20 Is scheduling pg_repack just a bad idea and just introducing just more = bloat? Why not just tune auto vacuum? 80/20 rule=E2=80=A6 most schemas are going to have their large/hot = tables, etc and data has a natural life cycle. If you have a heathy = application then bloat is not an issue as free space is used by new = tuples. Each database has a data flow to it depending on the maturity = and nature of the application/database. Exiting tuples make room for new = tuples, etc. If your have to vacuum full / pg_repack your tables on a scheduled bases = then I think there is something very wrong with your application. Pg_repack will do more harm in the long run. i.e. the entire time = pg_repack is running xmin is frozen thus creating more bloat everywhere = else!=20 Bloat is overrated; especially in a transaction system where all your = data access patterns should be well defined and not doing full table = scans. Just focus on identifying bloated indexes periodically and = rebuilding those. There should be no need to vacuum full tables under = normal circumstances.= --Apple-Mail=_7030AABF-5F10-4F07-8177-63EAD713DA5F Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8

On Aug 7, 2024, at 9:24 AM, jacob ndinkwa <jndinkwa@gmail.com> = wrote:

To schedule a pg_repack job using = pg_cron on an Amazon RDS for PostgreSQL instance, you need to follow a = few steps. However, it=E2=80=99s important to note that pg_cron is only = supported on certain versions of Amazon RDS, and pg_repack is also a = separate extension that must be installed and enabled.



Is scheduling pg_repack just = a bad idea and just introducing just more bloat? Why not just tune auto = vacuum?

80/20 = rule=E2=80=A6 most schemas are going to have their large/hot tables, etc = and data has a natural life cycle.  If you have a heathy = application then bloat is not an issue as free space is used by new = tuples.  Each database has a data flow to it depending on the = maturity and nature of the application/database. Exiting tuples make = room for new tuples, etc.

If your have to vacuum full / pg_repack your tables on a = scheduled bases then I think there is something very wrong with your = application.

Pg_repack will do more harm in the long run.  i.e. the = entire time pg_repack is running xmin is frozen thus creating more bloat = everywhere else! 

Bloat is overrated; especially in a transaction system where = all your data access patterns should be well defined and not doing full = table scans. Just focus on identifying bloated indexes periodically and = rebuilding those.  There should be no need to vacuum full tables = under normal circumstances.
= --Apple-Mail=_7030AABF-5F10-4F07-8177-63EAD713DA5F--