Обсуждение: cron tasks in pg 9.3

Поиск
Список
Период
Сортировка

cron tasks in pg 9.3

От
Joe Van Dyk
Дата:
Will the custom worker support in 9.3 let me put cron-like tasks into postgresql?

I have a lot of database functions that should run every few seconds, every minute, every hour, once a week, etc. Right now, I always have to have exactly one machine setup with cron tasks that tells postgresql to run whatever functions are necessary.

It would be super to let postgresql handle all of that.

Joe

Re: cron tasks in pg 9.3

От
Thomas Kellerer
Дата:
Joe Van Dyk wrote on 18.07.2013 23:23:
> Will the custom worker support in 9.3 let me put cron-like tasks into
> postgresql?
>
> I have a lot of database functions that should run every few seconds,
> every minute, every hour, once a week, etc. Right now, I always have
> to have exactly one machine setup with cron tasks that tells
> postgresql to run whatever functions are necessary.
>
> It would be super to let postgresql handle all of that.

What about pgAgent?

http://www.pgadmin.org/docs/1.16/pgagent.html

Re: cron tasks in pg 9.3

От
Joe Van Dyk
Дата:
On Thu, Jul 18, 2013 at 2:31 PM, Thomas Kellerer <spam_eater@gmx.net> wrote:
Joe Van Dyk wrote on 18.07.2013 23:23:

Will the custom worker support in 9.3 let me put cron-like tasks into
postgresql?

I have a lot of database functions that should run every few seconds,
every minute, every hour, once a week, etc. Right now, I always have
to have exactly one machine setup with cron tasks that tells
postgresql to run whatever functions are necessary.

It would be super to let postgresql handle all of that.

What about pgAgent?

http://www.pgadmin.org/docs/1.16/pgagent.html

That falls into the category of having to run another singleton (exactly one instance running) bit of software at all times. Not much difference between pgagent and cron, as far as I can tell.

I already always have a single postgresql master running at all times, it would be awesome the postgresql master process could be used to fire off these scheduled tasks. It seems like that would simplify many systems.

Joe

Re: cron tasks in pg 9.3

От
Alvaro Herrera
Дата:
Joe Van Dyk wrote:
> Will the custom worker support in 9.3 let me put cron-like tasks into
> postgresql?
>
> I have a lot of database functions that should run every few seconds, every
> minute, every hour, once a week, etc. Right now, I always have to have
> exactly one machine setup with cron tasks that tells postgresql to run
> whatever functions are necessary.

Yes, you should be able to do that, but there's no scheduling code yet.
There has been talk about porting the execution part (i.e. no UI) of
pgagent into a bgworker, but so far I don't know of any code.

If you want your tasks to just run some queries, that's easy to arrange.
If you want to do things like run separate processes (say pg_dump) it
might be a bit more involved.

The new facilities in 9.4 that let you start dynamic bgworkers would
ease things even more.

--
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services