From: | Franco Bruno Borghesi <franco(at)akyasociados(dot)com(dot)ar> |
---|---|
To: | gnotari(at)linkgroup(dot)it |
Cc: | PostgreSQL General <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Batch processing |
Date: | 2003-07-29 14:10:39 |
Message-ID: | 1059487839.2945.30.camel@taz.oficina |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Maybe the best option (specialy if you need users to control the jobs)
would be to create a table like this:
CREATE TABLE batchjobs (
id SERIAL,
sql TEXT NOT NULL,
done BOOLEAN NOT NOOL DEFAULT false
);
Then you create a pl/pgsql function that iterates every "undone" record
from this table
and EXECUTEs the query from the sql field (and sets the done field to
true).
You can run this process from crontab let's say, every 15 minutes (only
if this process is not already running) with a
echo "SELECT * FROM runJobs();"| psql ...
Hope this helps.
On Tue, 2003-07-29 at 05:28, gnotari(at)linkgroup(dot)it wrote:
> I'm in the need of something similar to Oracle's batch processing, in
> Postgres.
> I would like to have something like a queue of "requests" (SQL selects),
> run one by one, so not to overload the server -- every SELECT is
> 'intensive'.
>
> How would you implement such a thing?
>
> ciao
> Guido
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>
From | Date | Subject | |
---|---|---|---|
Next Message | Ron Johnson | 2003-07-29 14:19:06 | Re: concurrent writes |
Previous Message | Dave [Hawk-Systems] | 2003-07-29 13:41:42 | determine how many matches of a string in a field |