You need to enable JavaScript to run this app.
RDS for PostgreSQL

RDS for PostgreSQL

Copy page
Download PDF
Extensions
Logging extensions (pg_jobmon)
Copy page
Download PDF
Logging extensions (pg_jobmon)
pg_jobmon extension provides PostgreSQL with a non-transactional logging mechanism for transactions and functions to retain log information when transactions or functions fail. Even if your functions or transactions are Failed for any reason, the logged information will not be rolled back, thus ensuring the safety of critical log data.​
Precautions​
pg_jobmon extension is only supported on PostgreSQL instances version 14 and above. To use this extension, select the appropriate instance version when you create instance.​
Prerequisites​
  • pg_partman extension depends on the dblink extension. The dblink extension can be created using the following statement.​
  • ​
    CREATE EXTENSION dblink;​
    -- configure dblink related parameters​
    INSERT INTO test_schema.dblink_mapping_jobmon (host, username, pwd) VALUES ('127.***.***.1', 'test_user', 'test@123');​
    ​
Create and delete extension​
  • Create extension​
tip​
A super account is required to create the extension.​
​
CREATE EXTENSION pg_jobmon;​
​
  • Delete extension​
​
DROP EXTENSION pg_jobmon;​
​
Extension usage​
Create a task​
Functions below allow you to create job, add steps to a job, and update step state.​
​
-- create job and several steps​
select test_schema.add_job('job1');​
select test_schema.add_step(1, 'job1_step1');​
select test_schema.sql_step(1, 'job1_step2', 'select pg_sleep(3)');​
​
View task​
Functions below allow you to view job detail:​
  • show_job​
  • show_job_like​
  • show_job_status​
  • show_detail​
​
test_db=> -- view job​
test_db=> select test_schema.show_job('job1');​
show_job​
----------------------------------------------------------------------------------------------​
(1,test_user,JOB1,"2025-04-17 21:25:09.684233+08","2025-04-17 21:25:13.427808+08",OK,579004)​
(1 row)​
​
test_db=> select test_schema.show_job_like('job');​
show_job_like​
----------------------------------------------------------------------------------------------​
(1,test_user,JOB1,"2025-04-17 21:25:09.684233+08","2025-04-17 21:25:13.427808+08",OK,579004)​
(1 row)​
​
test_db=> select test_schema.show_job_status('job1', 'OK');​
show_job_status​
----------------------------------------------------------------------------------------------​
(1,test_user,JOB1,"2025-04-17 21:25:09.684233+08","2025-04-17 21:25:13.427808+08",OK,579004)​
(1 row)​
​
test_db=> select test_schema.show_detail(1);​
show_detail​
----------------------------------------------------------------------------------------------------------------​
(1,1,job1_step1,"2025-04-17 21:25:09.696224+08",,,,)​
(1,2,job1_step2,"2025-04-17 21:25:10.38315+08","2025-04-17 21:25:13.416171+08",3.033021,OK,"Rows affected: 1")​
(2 rows)​
​
End task​
​
-- end job​
select test_schema.close_job(1);​
select test_schema.check_job_status();​
​
​
Last updated: 2026.01.13 18:44:18