pgagent
pgagent
pgagent : A PostgreSQL job scheduler
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 5880 | pgagent | pgagent | 4.2.3 | ADMIN | PostgreSQL | C |
| Attribute | Has Binary | Has Library | Need Load | Has DDL | Relocatable | Trusted |
|---|---|---|---|---|---|---|
--s-d-- | No | Yes | No | Yes | no | no |
| Relationships | |
|---|---|
| See Also | pg_cron pg_task pg_jobmon pg_partman pglogical pg_background pg_repack pg_rewrite |
Packages
| Type | Repo | Version | PG Major Compatibility | Package Pattern | Dependencies |
|---|---|---|---|---|---|
| EXT | PGDG | 4.2.3 | 18 17 16 15 14 | pgagent | - |
| RPM | PGDG | 4.2.3 | 18 17 16 15 14 | pgagent_$v | - |
| DEB | PGDG | 4.2.3 | 18 17 16 15 14 | pgagent | - |
| Linux / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
el8.x86_64 | PGDG 4.2.3 | PGDG 4.2.3 | PGDG 4.2.3 | PGDG 4.2.3 | PGDG 4.2.3 |
el8.aarch64 | PGDG 4.2.3 | PGDG 4.2.3 | PGDG 4.2.3 | PGDG 4.2.3 | PGDG 4.2.3 |
el9.x86_64 | PGDG 4.2.3 | PGDG 4.2.3 | PGDG 4.2.3 | PGDG 4.2.3 | PGDG 4.2.3 |
el9.aarch64 | PGDG 4.2.3 | PGDG 4.2.3 | PGDG 4.2.3 | PGDG 4.2.3 | PGDG 4.2.3 |
el10.x86_64 | PGDG 4.2.3 | PGDG 4.2.3 | PGDG 4.2.3 | PGDG 4.2.3 | PGDG 4.2.3 |
el10.aarch64 | PGDG 4.2.3 | PGDG 4.2.3 | PGDG 4.2.3 | PGDG 4.2.3 | PGDG 4.2.3 |
d12.x86_64 | MISS | MISS | MISS | MISS | MISS |
d12.aarch64 | MISS | MISS | MISS | MISS | MISS |
d13.x86_64 | MISS | MISS | MISS | MISS | MISS |
d13.aarch64 | MISS | MISS | MISS | MISS | MISS |
u22.x86_64 | MISS | MISS | MISS | MISS | MISS |
u22.aarch64 | MISS | MISS | MISS | MISS | MISS |
u24.x86_64 | MISS | MISS | MISS | MISS | MISS |
u24.aarch64 | MISS | MISS | MISS | MISS | MISS |
| Package | Version | OS | ORG | SIZE | File URL |
|---|---|---|---|---|---|
pgagent_18 | 4.2.3 | el8.x86_64 | pgdg | 135.5 KiB | pgagent_18-4.2.3-1PGDG.rhel8.x86_64.rpm |
pgagent_18 | 4.2.3 | el8.aarch64 | pgdg | 129.6 KiB | pgagent_18-4.2.3-1PGDG.rhel8.aarch64.rpm |
pgagent_18 | 4.2.3 | el9.x86_64 | pgdg | 121.5 KiB | pgagent_18-4.2.3-1PGDG.rhel9.x86_64.rpm |
pgagent_18 | 4.2.3 | el9.aarch64 | pgdg | 117.8 KiB | pgagent_18-4.2.3-1PGDG.rhel9.aarch64.rpm |
pgagent_18 | 4.2.3 | el10.x86_64 | pgdg | 126.9 KiB | pgagent_18-4.2.3-1PGDG.rhel10.x86_64.rpm |
pgagent_18 | 4.2.3 | el10.aarch64 | pgdg | 116.6 KiB | pgagent_18-4.2.3-1PGDG.rhel10.aarch64.rpm |
| Package | Version | OS | ORG | SIZE | File URL |
|---|---|---|---|---|---|
pgagent_17 | 4.2.3 | el8.x86_64 | pgdg | 135.5 KiB | pgagent_17-4.2.3-1PGDG.rhel8.x86_64.rpm |
pgagent_17 | 4.2.2 | el8.x86_64 | pgdg | 133.9 KiB | pgagent_17-4.2.2-5PGDG.rhel8.x86_64.rpm |
pgagent_17 | 4.2.3 | el8.aarch64 | pgdg | 129.6 KiB | pgagent_17-4.2.3-1PGDG.rhel8.aarch64.rpm |
pgagent_17 | 4.2.2 | el8.aarch64 | pgdg | 128.2 KiB | pgagent_17-4.2.2-5PGDG.rhel8.aarch64.rpm |
pgagent_17 | 4.2.3 | el9.x86_64 | pgdg | 121.9 KiB | pgagent_17-4.2.3-1PGDG.rhel9.x86_64.rpm |
pgagent_17 | 4.2.2 | el9.x86_64 | pgdg | 120.3 KiB | pgagent_17-4.2.2-5PGDG.rhel9.x86_64.rpm |
pgagent_17 | 4.2.3 | el9.aarch64 | pgdg | 118.0 KiB | pgagent_17-4.2.3-1PGDG.rhel9.aarch64.rpm |
pgagent_17 | 4.2.2 | el9.aarch64 | pgdg | 116.7 KiB | pgagent_17-4.2.2-5PGDG.rhel9.aarch64.rpm |
pgagent_17 | 4.2.3 | el10.x86_64 | pgdg | 126.9 KiB | pgagent_17-4.2.3-1PGDG.rhel10.x86_64.rpm |
pgagent_17 | 4.2.3 | el10.aarch64 | pgdg | 116.6 KiB | pgagent_17-4.2.3-1PGDG.rhel10.aarch64.rpm |
| Package | Version | OS | ORG | SIZE | File URL |
|---|---|---|---|---|---|
pgagent_16 | 4.2.3 | el8.x86_64 | pgdg | 135.5 KiB | pgagent_16-4.2.3-1PGDG.rhel8.x86_64.rpm |
pgagent_16 | 4.2.2 | el8.x86_64 | pgdg | 133.5 KiB | pgagent_16-4.2.2-3.rhel8.x86_64.rpm |
pgagent_16 | 4.2.3 | el8.aarch64 | pgdg | 129.6 KiB | pgagent_16-4.2.3-1PGDG.rhel8.aarch64.rpm |
pgagent_16 | 4.2.2 | el8.aarch64 | pgdg | 127.9 KiB | pgagent_16-4.2.2-3.rhel8.aarch64.rpm |
pgagent_16 | 4.2.3 | el9.x86_64 | pgdg | 122.0 KiB | pgagent_16-4.2.3-1PGDG.rhel9.x86_64.rpm |
pgagent_16 | 4.2.2 | el9.x86_64 | pgdg | 120.0 KiB | pgagent_16-4.2.2-3.rhel9.x86_64.rpm |
pgagent_16 | 4.2.3 | el9.aarch64 | pgdg | 118.0 KiB | pgagent_16-4.2.3-1PGDG.rhel9.aarch64.rpm |
pgagent_16 | 4.2.2 | el9.aarch64 | pgdg | 116.4 KiB | pgagent_16-4.2.2-3.rhel9.aarch64.rpm |
pgagent_16 | 4.2.3 | el10.x86_64 | pgdg | 126.9 KiB | pgagent_16-4.2.3-1PGDG.rhel10.x86_64.rpm |
pgagent_16 | 4.2.3 | el10.aarch64 | pgdg | 116.6 KiB | pgagent_16-4.2.3-1PGDG.rhel10.aarch64.rpm |
| Package | Version | OS | ORG | SIZE | File URL |
|---|---|---|---|---|---|
pgagent_15 | 4.2.3 | el8.x86_64 | pgdg | 135.5 KiB | pgagent_15-4.2.3-1PGDG.rhel8.x86_64.rpm |
pgagent_15 | 4.2.2 | el8.x86_64 | pgdg | 133.4 KiB | pgagent_15-4.2.2-1.rhel8.x86_64.rpm |
pgagent_15 | 4.2.3 | el8.aarch64 | pgdg | 129.6 KiB | pgagent_15-4.2.3-1PGDG.rhel8.aarch64.rpm |
pgagent_15 | 4.2.2 | el8.aarch64 | pgdg | 127.7 KiB | pgagent_15-4.2.2-1.rhel8.aarch64.rpm |
pgagent_15 | 4.2.3 | el9.x86_64 | pgdg | 122.0 KiB | pgagent_15-4.2.3-1PGDG.rhel9.x86_64.rpm |
pgagent_15 | 4.2.2 | el9.x86_64 | pgdg | 119.1 KiB | pgagent_15-4.2.2-1.rhel9.x86_64.rpm |
pgagent_15 | 4.2.3 | el9.aarch64 | pgdg | 118.1 KiB | pgagent_15-4.2.3-1PGDG.rhel9.aarch64.rpm |
pgagent_15 | 4.2.2 | el9.aarch64 | pgdg | 114.4 KiB | pgagent_15-4.2.2-1.rhel9.aarch64.rpm |
pgagent_15 | 4.2.3 | el10.x86_64 | pgdg | 126.9 KiB | pgagent_15-4.2.3-1PGDG.rhel10.x86_64.rpm |
pgagent_15 | 4.2.3 | el10.aarch64 | pgdg | 116.6 KiB | pgagent_15-4.2.3-1PGDG.rhel10.aarch64.rpm |
| Package | Version | OS | ORG | SIZE | File URL |
|---|---|---|---|---|---|
pgagent_14 | 4.2.3 | el8.x86_64 | pgdg | 135.5 KiB | pgagent_14-4.2.3-1PGDG.rhel8.x86_64.rpm |
pgagent_14 | 4.2.2 | el8.x86_64 | pgdg | 133.4 KiB | pgagent_14-4.2.2-1.rhel8.x86_64.rpm |
pgagent_14 | 4.2.1 | el8.x86_64 | pgdg | 153.1 KiB | pgagent_14-4.2.1-1.rhel8.x86_64.rpm |
pgagent_14 | 4.2.3 | el8.aarch64 | pgdg | 129.6 KiB | pgagent_14-4.2.3-1PGDG.rhel8.aarch64.rpm |
pgagent_14 | 4.2.2 | el8.aarch64 | pgdg | 127.7 KiB | pgagent_14-4.2.2-1.rhel8.aarch64.rpm |
pgagent_14 | 4.2.3 | el9.x86_64 | pgdg | 122.0 KiB | pgagent_14-4.2.3-1PGDG.rhel9.x86_64.rpm |
pgagent_14 | 4.2.2 | el9.x86_64 | pgdg | 119.1 KiB | pgagent_14-4.2.2-1.rhel9.x86_64.rpm |
pgagent_14 | 4.2.1 | el9.x86_64 | pgdg | 138.6 KiB | pgagent_14-4.2.1-1.rhel9.x86_64.rpm |
pgagent_14 | 4.2.3 | el9.aarch64 | pgdg | 118.0 KiB | pgagent_14-4.2.3-1PGDG.rhel9.aarch64.rpm |
pgagent_14 | 4.2.2 | el9.aarch64 | pgdg | 114.4 KiB | pgagent_14-4.2.2-1.rhel9.aarch64.rpm |
pgagent_14 | 4.2.3 | el10.x86_64 | pgdg | 126.9 KiB | pgagent_14-4.2.3-1PGDG.rhel10.x86_64.rpm |
pgagent_14 | 4.2.3 | el10.aarch64 | pgdg | 116.7 KiB | pgagent_14-4.2.3-1PGDG.rhel10.aarch64.rpm |
Source
Install
Make sure PGDG repo available:
pig repo add pgdg -u # add pgdg repo and update cacheInstall this extension with pig:
pig install pgagent; # install via package name, for the active PG version
pig install pgagent -v 18; # install for PG 18
pig install pgagent -v 17; # install for PG 17
pig install pgagent -v 16; # install for PG 16
pig install pgagent -v 15; # install for PG 15
pig install pgagent -v 14; # install for PG 14Create this extension with:
CREATE EXTENSION pgagent;Usage
pgAgent is a job scheduling agent for PostgreSQL, capable of running multi-step batch/shell scripts and SQL tasks on complex schedules. It runs as a daemon and stores job definitions in the database.
Core Concepts
- Job: A named schedulable unit containing one or more steps and schedules
- Step: An individual action (SQL script or OS batch/shell command) within a job
- Schedule: Defines when a job runs, with cron-like flexibility
Job Management via SQL
pgAgent stores its configuration in the pgagent schema. Jobs can be managed through pgAdmin or directly via SQL.
-- View all jobs
SELECT jobid, jobname, jobenabled, jobdesc
FROM pgagent.pga_job;
-- View job steps
SELECT jstid, jstjobid, jstname, jstenabled, jstkind, jstcode
FROM pgagent.pga_jobstep;
-- View job schedules
SELECT jscid, jscjobid, jscname, jscenabled,
jscstart, jscend, jscminutes, jschours,
jscweekdays, jscmonthdays, jscmonths
FROM pgagent.pga_schedule;
-- View job execution log
SELECT * FROM pgagent.pga_joblog
WHERE jlgjobid = 1 ORDER BY jlgstart DESC;
-- View step execution log
SELECT * FROM pgagent.pga_jobsteplog
WHERE jsljlgid IN (SELECT jlgid FROM pgagent.pga_joblog WHERE jlgjobid = 1)
ORDER BY jslstart DESC;Step Types
| Kind | Description |
|---|---|
s | SQL script executed against a database |
b | Batch/shell command executed on the OS |
Schedule Fields
| Field | Description |
|---|---|
jscstart / jscend | Valid date range for the schedule |
jscminutes | Boolean array[60]: which minutes to run |
jschours | Boolean array[24]: which hours to run |
jscweekdays | Boolean array[7]: which days of week |
jscmonthdays | Boolean array[32]: which days of month |
jscmonths | Boolean array[12]: which months |
Security
The pgAgent daemon connects to the database using a stored connection string. Only database superusers or users granted appropriate privileges on the pgagent schema tables should manage jobs.
Last updated on