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

From: Daniel Farina <daniel(at)heroku(dot)com>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Christopher Browne <cbbrowne(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Dimitri Fontaine <dimitri(at)2ndquadrant(dot)fr>, Josh Berkus <josh(at)agliodbs(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 23:49:03
Message-ID: CAAZKuFZWVr_jcxf6sKxj6YD7m7QQ=wjK4c9pRBMPQ2ODvVaW8g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Mar 6, 2012 at 3:31 PM, Andrew Dunstan <andrew(at)dunslane(dot)net> wrote:>
> We don't slavishly need to reproduce every piece of cron. In any case, on my
> Linux machine at least, batch is part of the "at" package, not the "cron"
> package. If you want anything at all done, then I'd suggest starting with a
> simple scheduler. Just about he quickest way to get something rejected in
> Postgres is to start with something overly complex and baroque.

I sort agree with this, I think. However, I don't see the need to
have Postgres get involved with scheduling and triggering of jobs at
all. Rather, it just doesn't have support for what I'd think of as a
"job", period, regardless of how it gets triggered.

The crux of the issue for me is that sometimes it's pretty annoying to
have to maintain a socket connection just to get some things to run
for a while: I can't tell the database "execute stored procedure (not
UDF) 'job' in a new backend, I'm going to disconnect now".

Nearly relatedly, I've heard from at least two people in immediate
memory that would like database sessions to be reified somehow from
their socket, so that they could resume work in a session that had a
connection blip.

At the same time, it would really suck to have an "idle in
transaction" because a client died and didn't bother to reconnect and
clean up...a caveat.

Nevertheless, I think session support (think "GNU screen" or "tmux")
is both useful and painful to accomplish without backend support (for
example, the BackendKey might be useful). And stored procedures are a
familiar quantity at large...

Thoughts?

--
fdr

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2012-03-07 00:01:46 Re: pgsql_fdw, FDW for PostgreSQL server
Previous Message Andrew Dunstan 2012-03-06 23:31:16 Re: elegant and effective way for running jobs inside a database