From: Daniel Caune <daniel.caune@ubisoft.com>
To: Owen Jacobson <ojacobson@osl.com>
To: pgsql-sql@postgresql.org
Subject: Re: Does PostgreSQL support job?
Date: Wed, 1 Feb 2006 18:25:54 -0500
Message-ID: <1E293D3FF63A3740B10AD5AAD88535D201755923@UBIMAIL1.ubisoft.org> (raw)
> -----Message d'origine-----
> De : Owen Jacobson [mailto:ojacobson@osl.com]
> Envoyé : mercredi, février 01, 2006 18:00
> À : Daniel Caune; pgsql-sql@postgresql.org
> Objet : RE: [SQL] Does PostgreSQL support job?
>
> Daniel Caune wrote:
> > Hi,
> >
> > I try to find in the documentation whether PostgreSQL supports job,
> > but I miserably failed. Does PostgreSQL support job? If not, what
> > is the mechanism mostly adopted by PostgreSQL administrators for
> > running jobs against PostgreSQL? I was thinking about using
> > cron/plsql/sql-scripts on Linux.
>
> The answer really depends on what you mean by "jobs". If you have a
> database task that can be expressed as a series of commands with no
> interaction involved, you can just put those commands in a file (your-job-
> name.sql) and run it using psql and cron:
>
> # replace leading stars with cron time settings
> * * * * * psql your-database -i your-job-name.sql
>
Yes, that's it. A job is a task, i.e. set of statements, which is scheduled to run against a RDBMS at periodical times. Some RDBMS, such as SQL Server and Oracle, support that feature, even if such a feature is managed differently from a RDBMS to another.
OK. I get it. I will use cron and psql as I was planning to do so.
> If you need something more complex, either a function which is executed
> from a script or a full-blown client program may be required. IME that's
> fairly rare.
>
I'm not sure to understand. Why calling a function from a script is different from executing a series of SQL commands? I mean, I can run a script defined as follows:
SELECT myjob();
where myjob is a stored procedure such as:
CREATE OR REPLACE FUNCTION myjob()
RETURNS void
AS $$
<a-lot-of-complex-stuff-here>
END;
$$ LANGUAGE PLPGSQL;
Does that make sense?
--
Daniel CAUNE
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: daniel.caune@ubisoft.com, ojacobson@osl.com
Subject: Re: Does PostgreSQL support job?
In-Reply-To: <1E293D3FF63A3740B10AD5AAD88535D201755923@UBIMAIL1.ubisoft.org>
References: <1E293D3FF63A3740B10AD5AAD88535D201755923@UBIMAIL1.ubisoft.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox