Subject: Pg_repack

From: Sathish Reddy <[email-masked]>
Date: Tue, 6 Aug 2024 16:39:53 +0530

Hi
  We planning to create store procedure (function) in postgres database to
run pg_repack on removing bloating of table or index by using within
postgres instance.

    Please help me on details on steps with example for same.

Thanks
Sathishreddy

---

From: hubert depesz lubaczewski <[email-masked]>
Date: Tue, 6 Aug 2024 13:15:33 +0200

>     Please help me on details on steps with example for same.

That will be impossible and/or hard.

The problem is that stored procedure/functions runs in database. and
pg_repack is external program, that *does stuff in database*, but it not
*all* in database.

It's kinda as if you wanted to make stored procedure to run photoshop.

You can kinda work around it by using some PL/* language that allows
external program execution, but it is extremely unlikely to do what
you'd think it will do.

Best regards,

depesz

---

From: Sathish Reddy <[email-masked]>
Date: Tue, 6 Aug 2024 16:50:33 +0530

Thanks for the information.please provide me solution on clearing bloating
on table or index bloating with out blocking any user and we are not run
any vaccum full .freeze, and reindex and also analized ...with out these
provide me perfect solution to run and remove bloat instance level with in
postgres..

Thanks
Sathishreddy

---

From: hubert depesz lubaczewski <[email-masked]>
Date: Tue, 6 Aug 2024 13:22:21 +0200

> provide me perfect solution to run and remove bloat instance level with in

1. Configure autovacuum properly, so the problem doesn't happen.
2. If need is - run manual vacuum
3. If you really have to, run pg_repack - but this is not a thing that
   one calls *from within pg* - you run it on some
   server/computer/whatever, and pg_repack connects to database, and
   does its magic.

Best regards,

depesz

---

From: abbas alizadeh <[email-masked]>
Date: Tue, 6 Aug 2024 14:54:28 +0330

Hi
Why you don’t use pg_squeeze?

It has its own scheduling to remove bloating.

Regards
Abbas

On 6 Aug 2024, at 2:51 PM, Sathish Reddy <[email-masked]> wrote:

Thanks for the information.please provide me solution on clearing bloating on table or index bloating with out blocking any user and we are not run any vaccum full .freeze, and reindex and also analized ...with out these provide me perfect solution to run and remove bloat instance level with in postgres..

Thanks

Sathishreddy

On Tue, Aug 6, 2024, 4:45 PM hubert depesz lubaczewski <[email-masked]> wrote:

*all* in database.

you'd think it will do.

Best regards,

depesz

---

From: Kashif Zeeshan <[email-masked]>
Date: Tue, 6 Aug 2024 16:24:57 +0500

Hi Sathish

It's better to script it using any scripting language e.g. SHELL Scripting
as PL/pgSQL etc don't allow accessing Utilities from stored procedures.

Thanks
Kashif Zeeshan

---

From: Sathish Reddy <[email-masked]>
Date: Tue, 6 Aug 2024 17:02:14 +0530

Thanks for the tip! We are trying in RDS postgres database environment and
also we are trying to run as instance level as like functional

Thanks
Sathishreddy

On Tue, Aug 6, 2024, 4:56 PM abbas alizadeh <[email-masked]> wrote:

> On 6 Aug 2024, at 2:51 PM, Sathish Reddy <