Versions:

add_job()
Community

Register an action to be scheduled by our automation framework. Please read the [instructions][using-actions] for more details including multiple example actions.

Required Arguments

NameTypeDescription
procREGPROCName of the function or procedure to register as job
schedule_intervalINTERVALInterval between executions of this job

Optional Arguments

NameTypeDescription
configJSONBJob-specific configuration (this will be passed to the function when executed)
initial_startTIMESTAMPTZTime of first execution of job
scheduledBOOLEANSet to FALSE to exclude this job from scheduling. Defaults to TRUE.

Returns

ColumnTypeDescription
job_idINTEGERTimescaleDB background job id

Sample Usage

CREATE OR REPLACE PROCEDURE user_defined_action(job_id int, config jsonb) LANGUAGE PLPGSQL AS
$$
BEGIN
  RAISE NOTICE 'Executing action % with config %', job_id, config;
END
$$;

SELECT add_job('user_defined_action','1h');

Register the procedure user_defined_action to be run every hour.

Found an issue on this page?

Report an issue!