Ask a Question
Report a Bug
This page in other versions:
Warning: This documentation is for a pre-release version of pgAdmin 4
pgAgent is a scheduling agent that runs and manages jobs; each job consists of
steps and schedules.
To create or manage a job, use the pgAdmin tree control to browse to the server
on which the pgAgent database objects were created. The tree control will
display a pgAgent Jobs node, under which currently defined jobs are displayed.
To add a new job, right click on the pgAgent Jobs node, and select Create
pgAgent Job… from the context menu.
When the pgAgent dialog opens, use the tabs on the pgAgent Job dialog to
define the steps and schedule that make up a pgAgent job.
Use the fields on the General tab to provide general information about a job:
Provide a name for the job in the Name field.
Move the Enabled switch to the Yes position to enable a job, or No to
disable a job.
Use the Job Class drop-down to select a class (for job categorization).
Use the Host Agent field to specify the name of a machine that is running
pgAgent to indicate that only that machine may execute the job. Leave the
field blank to specify that any machine may perform the job.
It is not always obvious what value to specify for the Host Agent
in order to target a job step to a specific machine. With pgAgent running
on the required machines and connected to the scheduler database, you can
use the following query to view the hostnames as reported by each agent:
SELECT jagstation FROM pgagent.pga_jobagent
Use the hostname exactly as reported by the query in the Host Agent
Use the Comment field to store notes about the job.
Use the Steps tab to define and manage the steps that the job will perform.
Click the Add icon (+) to add a new step; then click the compose icon (located
at the left side of the header) to open the step definition dialog:
Use fields on the step definition dialog to define the step:
The fields Connection type, Database and Connection string are only
applicable when SQL is selected because Batch cannot be run on remote servers.
Use the context-sensitive field on the step definition dialog’s Code tab to
provide the SQL code or batch script that will be executed during the step:
When you’ve provided all of the information required by the step, click the
compose icon to close the step definition dialog. Click the add icon (+) to
add each additional step, or select the Schedules tab to define the job
Click the Add icon (+) to add a schedule for the job; then click the compose
icon (located at the left side of the header) to open the schedule definition
Use the fields on the schedule definition tab to specify the days and times at
which the job will execute.
Select the Repeat tab to define the days on which the schedule will execute.
Use the fields on the Repeat tab to specify the details about the schedule in
a cron-style format. The job will execute on each date or time element selected
on the Repeat tab.
Click within a field to open a list of valid values for that field; click on a
specific value to add that value to the list of selected values for the field.
To clear the values from a field, click the X located at the right-side of the
Use the fields within the Days box to specify the days on which the job will
Use the fields within the Times box to specify the times at which the job will
Select the Exceptions tab to specify any days on which the schedule will not
Use the fields on the Exceptions tab to specify days on which you wish the job
to not execute; for example, you may wish for jobs to not execute on national
Click the Add icon (+) to add a row to the exception table, then:
When you’ve finished defining the schedule, you can use the SQL tab to review
the code that will create or modify your job.
Click the Save button to save the job definition, or Cancel to exit the job
without saving. Use the Reset button to remove your unsaved entries from the
After saving a job, the job will be listed under the pgAgent Jobs node of the
pgAdmin tree control of the server on which it was defined. The Properties
tab in the main pgAdmin window will display a high-level overview of the
selected job, and the Statistics tab will show the details of each run of the
To modify an existing job or to review detailed information about a job,
right-click on a job name, and select Properties from the context menu.