Sheduling in SQL

From: Paul <magamos(at)mail(dot)ru>
To: "pgsql-hackers(at)postgreSQL(dot)org" <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Sheduling in SQL
Date: 2001-03-15 09:40:47
Message-ID: 2618870624.20010315144047@mail.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Sorry, if I used not corresponding mailing list, but I really dont
know where to send such email.

Is that possible to add one more SQL command to Postgres? The problem
that IMHO no one RDBMS allows SQL command for sheduling. To support
sheduling SQL programmers have to use outer tools to periodically
check database if event commit. But IMHO it's much better to add one
more SQL command to allow sheduling in same SQL.

My thoughts about such command follow:
=====================================================================

The SQL command for sheduler creating:

CREATE SHEDULER name
ON table.field
[FOR [EACH]|[LAST]]
EXECUTE PROCEDURE func(arguments)

When the current time becomes equal or more than minimal time in
the _table.field_, the event happens and the _func_ will be executed,
and after that all records in this _table_ that in the _field_ have
time equal or less than current time will be deleted.

The other fields of this _table_ could be used as _arguments_ (or
agregates of the other fields when _FOR EACH_ is absent).

_FOR LAST_ - only for the record(s) of the _table_ that has(ve) the
maximum time (that equal or less the current time) the event(s) will
be processed.

_FOR EACH_ - if there is such parameter for each corresponding record
the event could be processed, not for all at once.

For each _CREATE SHEDULER_ will be created:
1. B-tree index on _table.field_.
2. Inner trigger on insert/delete/update _table.field_ to have up to
date min(_table.field_) for nearest event processing.

The SQL command for sheduler deleting:

DELETE SHEDULER name

====================================================================

--
Best regards,
Paul Mamin mailto:magamos(at)mail(dot)ru

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Denis Perchine 2001-03-15 09:50:53 Re: Database corruption in 7.0.3
Previous Message Tim Allen 2001-03-15 08:52:13 Database corruption in 7.0.3