Re: Schedule Jobs in Postgres

From: "scott(dot)marlowe" <scott(dot)marlowe(at)ihs(dot)com>
To: Madhavi Daroor <madhavi(at)zoniac(dot)com>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Schedule Jobs in Postgres
Date: 2003-05-14 15:43:56
Message-ID: Pine.LNX.4.33.0305140942100.30919-100000@css120.ihs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, 14 May 2003, scott.marlowe wrote:

> On Wed, 14 May 2003, Madhavi Daroor wrote:
>
> > Hi all,
> > My company ZONIAC INDIA PVT LTD is extensively using Pstgres as the
> > database for their product. And right now I'm in need to schedule a job that
> > inserts a record into a table based on the value of a field in another
> > table. How can I do this? Please let me know as soon as possible. It is
> > URGENT!!!.
> >
> > I'm not talking about triggers because no other event is triggering this
> > particular job. This job must be scheduled so that as soon as the difference
> > between the value in a field and a particular date is reduced to 1 day, a
> > record is inserted in another table.
>
> You're likely gonna need to write a cron job that runs when the date
> changes, or whatnot. Then, you can run it with something like:
>
> psql dbname -c -- 'query goes here'
>
> Basically, making things happen on at a certain time is cron's job.

To add to this, it might work by writing a stored proc or something
similar that does the checking, then schedule a cron job to run every 5
minutes or so and call that stored procedure. That way, most of the code
is in postgresql, and all the cron job does is give it a wake up call
every so often.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Richard Huxton 2003-05-14 15:51:18 Re: - what protocol for an Internet postgres connection
Previous Message Stephan Szabo 2003-05-14 15:41:44 Re: query help