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();
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