Re: pg_cron for vacuum - dynamic table set

From: Ron <ronljohnsonjr(at)gmail(dot)com>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: pg_cron for vacuum - dynamic table set
Date: 2022-02-03 21:55:29
Message-ID: db019bac-b18a-e2fb-6c95-7750bb3e6d21@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 2/3/22 3:29 PM, saket bansal wrote:
> Hi, I am trying to schedule pg_cron to generate a set of commands and then
> run them. E.g |select 'vacuum freeze '||table_name from
> inventory_for_vacuum \gexec| . This works well at command line, but when
> scheduled in pg_cron, it fails with syntax error |ERROR: syntax error at
> or near "\"| .
> Since vacuum doesn't work inside a transaction block |ERROR: VACUUM cannot
> run inside a transaction block|, I cannot use a function directly to run
> over a loop.
> Any guidance to make it work or an alternative?

What about running the command from regular cron?

--
Angular momentum makes the world go 'round.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Michael Lewis 2022-02-03 22:30:22 Re: increasing effective_cache_size slows down join queries by a factor of 4000x
Previous Message Michael Lewis 2022-02-03 21:53:02 Re: pg_cron for vacuum - dynamic table set