Search Postgresql Archives

Re: How to run a task continuously in the background

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jul 16, 2019 at 7:32 AM Dirk Mika <Dirk.Mika@xxxxxxxxxxxxx> 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 data via a job is deliberately chosen so as to separate the insertion of the data from their processing.

So, as far as I understand, you want asynchronously processing data
with a process that can be started manually and/or periodically.
I'm probably unable to see what is the goal, but I would go for a
combined solution:
1) a trigger that notifies an external process
<https://www.postgresql.org/docs/current/sql-notify.html>
2) the process runs when notified (by the trigger) or when started
manually or when started by pg_cron (one per minute).

Of course the process is "internal", so something like a stored
procedure (at least as entry point).
The problem with such solution is about race conditions (what if you
manually start something that is already running?), but I guess you
had this problem on the oracle side too.

Hope this helps.
Luca





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux