Sample Header Ad - 728x90

pgAgent unwanted delay between jobs start time

1 vote
1 answer
254 views
I've been trying to make jobs running continuosly, so after previous run is done, the next one starts immediately. I made some initial success with following trigger: CREATE or replace FUNCTION continous_jobs() RETURNS trigger AS $$ BEGIN NEW.jobnextrun = clock_timestamp(); RETURN NEW; END; $$ LANGUAGE plpgsql; CREATE TRIGGER continous_jobs_trg BEFORE UPDATE OF jobnextrun ON pgagent.pga_job FOR EACH ROW when (NEW.jobdesc = 'CONTINOUS_JOB' ) EXECUTE PROCEDURE continous_jobs(); I set some test job, with pg_sleep(5) inside, and it worked great enter image description here But after that I put there some real procedure inside, and it started to have delays (3-5 seconds). Why is that happening? I tried setting different jobnextrun values, also clock_timestamp() - '5 second'::interval, but it's still the same, delay is about couple of seconds
Asked by sh4rkyy (149 rep)
Dec 16, 2022, 10:25 AM
Last activity: Dec 25, 2022, 08:40 PM