Scheduling pg_repack job with pg_cron

Started by Durgamahesh Manneover 1 year ago2 messagesgeneral
Jump to latest
#1Durgamahesh Manne
maheshpostgres9@gmail.com

Hi
Respected Team

Is there any way to schedule a pg_repack job with pg_cron within the
instance ?

If yes then please please let me know the best approach to schedule it with
pg_cron within the instance.( not in bastion host)

your response is highly valuable

Regards.
Durga Mahesh

#2Muhammad Imtiaz
imtiazpg712@gmail.com
In reply to: Durgamahesh Manne (#1)
Re: Scheduling pg_repack job with pg_cron

Hi ,

Yes, you can use it. Create a bash script containing the pg_repack
command logic, then call this bash script from a PL/pgSQL function.
Finally, schedule this PL/pgSQL function using pg_cron as follows.
SELECT cron.schedule('pg_repack_job', '00 3 * * 1-5', $$SELECT repackfunc();$$);

*Muhammad Imtiaz*

*PostgreSQL Technical Support Lead *
*/ Pakistan R&D*
*Mobile: +923345072521*
*Email: imtiaz.m@bitnine.net <imtiaz.m@bitnine.net>*

On Tue, Jul 30, 2024 at 1:58 PM Durgamahesh Manne <maheshpostgres9@gmail.com>
wrote:

Show quoted text

Hi
Respected Team

Is there any way to schedule a pg_repack job with pg_cron within the
instance ?

If yes then please please let me know the best approach to schedule it
with pg_cron within the instance.( not in bastion host)

your response is highly valuable

Regards.
Durga Mahesh