Re: elegant and effective way for running jobs inside a database

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Artur Litwinowicz <admin(at)ybka(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: elegant and effective way for running jobs inside a database
Date: 2012-03-06 16:36:14
Message-ID: 1331051464-sup-5208@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Excerpts from Tom Lane's message of mar mar 06 12:47:46 -0300 2012:
> Robert Haas <robertmhaas(at)gmail(dot)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(at)commandprompt(dot)com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2012-03-06 16:42:17 Re: Checksums, state of play
Previous Message Bruce Momjian 2012-03-06 16:26:50 Re: Dropping PL language retains support functions