Re: elegant and effective way for running jobs inside a database - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: elegant and effective way for running jobs inside a database
Date
Msg-id 1331051464-sup-5208@alvh.no-ip.org
Whole thread Raw
In response to Re: elegant and effective way for running jobs inside a database  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: elegant and effective way for running jobs inside a database  (Artur Litwinowicz <admin@ybka.com>)
List pgsql-hackers
Excerpts from Tom Lane's message of mar mar 06 12:47:46 -0300 2012:
> Robert Haas <robertmhaas@gmail.com> writes:

> > But since you brought it up, I think there is a lot of value to having
> > a scheduler that's integrated with the database.  There are many
> > things that the database does which could also be done outside the
> > database, but people want them in the database because it's easier
> > that way.  If you have a web application that talks to the database,
> > and which sometimes needs to schedule tasks to run at a future time,
> > it is much nicer to do that by inserting a row into an SQL table
> > somewhere, or executing some bit of DDL, than it is to do it by making
> > your web application know how to connect to a PostgreSQL database and
> > also how to rewrite crontab (in a concurrency-safe manner, no less).
>
> Sure, and I would expect that a client-side scheduler would work just
> the same way: you make requests to it through database actions such
> as inserting a row in a task table.

What such an external scheduler would need from core is support for
starting up and shutting down along postmaster (as well as restarts at
appropriate times).  Postmaster already has the ability to start and
shut down many processes depending on several different policies; I
think it's mostly a matter of exporting that funcionality in a sane way.

--
Álvaro Herrera <alvherre@commandprompt.com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Dropping PL language retains support functions
Next
From: Robert Haas
Date:
Subject: Re: Checksums, state of play