Re: How to run a task continuously in the background

2019-07-22 Thread Rory Campbell-Lange
On 19/07/19, Peter J. Holzer (hjp-pg...@hjp.at) wrote: > On 2019-07-17 12:34:41 +0100, Rory Campbell-Lange wrote: > > We make extensive use of postgresql 'contacting' an external process, > > but our use case involves many databases in a cluster rather than many > > schemas. Also we don't have to d

Re: How to run a task continuously in the background

2019-07-19 Thread Peter J. Holzer
On 2019-07-17 12:34:41 +0100, Rory Campbell-Lange wrote: > We make extensive use of postgresql 'contacting' an external process, > but our use case involves many databases in a cluster rather than many > schemas. Also we don't have to deal with cancelling the external > process. We chose this archi

Re: How to run a task continuously in the background

2019-07-17 Thread Rory Campbell-Lange
On 17/07/19, Luca Ferrari (fluca1...@gmail.com) wrote: > On Wed, Jul 17, 2019 at 9:38 AM Dirk Mika wrote: > > That is basically still my main question. How do I start a > > background job (e.g. a function) which waits by polling or LISTEN / > > NOTIFY for records in a table to be processed. > > Y

Re: How to run a task continuously in the background

2019-07-17 Thread Weatherby,Gerard
We used a python process running continually on a linux client for the LISTEN piece. Reading the documentation, it seems that a background worker ( https://www.postgresql.org/docs/11/bgworker.html) might be a solution to your requirements. I don’t have personal experience with them. -- Gerard W

Re: How to run a task continuously in the background

2019-07-17 Thread Luca Ferrari
On Wed, Jul 17, 2019 at 9:38 AM Dirk Mika wrote: > That is basically still my main question. How do I start a background job > (e.g. a function) which waits by polling or LISTEN / NOTIFY for records in a > table to be processed. You will have a trigger that, once new tuples are created (or old

Re: How to run a task continuously in the background

2019-07-17 Thread Rob Sargent
> On Jul 17, 2019, at 1:26 AM, Dirk Mika wrote: > > > We used a trigger that called pg_notify > (https://www.postgresql.org/docs/9.5/sql-notify.html > ​) and then had another > > process that LISTENed for notifications. > > > > What

Re: How to run a task continuously in the background

2019-07-16 Thread Luca Ferrari
On Tue, Jul 16, 2019 at 7:32 AM Dirk Mika wrote: > It's not really important that the job runs once a second, but that it starts > immediately when I want it to. > > If I start a job with pg_cron, it will not be executed until the next full > minute at the earliest. > > The processing of the dat

Re: How to run a task continuously in the background

2019-07-15 Thread Luca Ferrari
On Fri, Jul 12, 2019 at 7:06 AM Dirk Mika wrote: > > > > A cron job will only run once a minute, not wake up every second. > > > > I would like to avoid external programs if possible. In the current Oracle > environment, there are potentially multiple schemas on a server in which > processing ca

Re: How to run a task continuously in the background

2019-07-12 Thread Tim Clarke
On 12/07/2019 08:08, lilu wrote: > >> 在 2019年7月12日,下午1:06,Dirk Mika > > 写道: >> >> A cron job will only run once a minute, not wake up every second. >> Right, that’s an issue. >> But you could write a PHP program that does a one-second sleep before >> checking if the

Re: How to run a task continuously in the background

2019-07-12 Thread lilu
> 在 2019年7月12日,下午1:06,Dirk Mika 写道: > > > A cron job will only run once a minute, not wake up every second. > > Right, that’s an issue. > > But you could write a PHP program that does a one-second sleep before > checking if there's something to do, and a batch job that runs periodically

Re: How to run a task continuously in the background

2019-07-11 Thread Alan Hodgson
On Thu, 2019-07-11 at 11:19 -0500, Michael Nolan wrote: > A cron job will only run once a minute, not wake up every second. > But you could write a PHP program that does a one-second sleep before > checking if there's something to do, and a batch job that runs > periodically to see if the PHP prog

Re: How to run a task continuously in the background

2019-07-11 Thread Michael Nolan
A cron job will only run once a minute, not wake up every second. But you could write a PHP program that does a one-second sleep before checking if there's something to do, and a batch job that runs periodically to see if the PHP program is running, and if not, launch it. That's how I handle a jo

RE: How to run a task continuously in the background

2019-07-11 Thread Steven Winfield
pg_cron, perhaps? https://www.citusdata.com/blog/2016/09/09/pgcron-run-periodic-jobs-in-postgres/ I _think_ it ticks all three of your boxes. Steve. This email is confidential. If you are not the intended recipient, please advise us immediately and delete this message. The registered name o