How to Setup pgAgent for Postgres Plus

How to Setup pgAgent for Postgres Plus

pgAgent is a pre-bundled enterprise module installed by default with Postgres Plus Standard Server and Postgres Plus Advanced Server. The pgAgent job scheduler allows authorized users to schedule jobs consisting of one or more SQL or shell/batch steps. Common uses include scheduled tasks such as archiving old records from a table, vacuuming certain tables, or performing application-oriented operations such as batch posting daily transactions to accounts.


This EnterpriseDB Quick Tutorial helps you get started with the Postgres Plus Standard Server database product. It is assumed that you have already downloaded and installed Postgres Plus Standard Server on your desktop or laptop computer.

This Quick Tutorial is designed to help you expedite your Technical Evaluation of Postgres Plus Standard Server. For more informational assets on conducting your evaluation of Postgres Plus, visit the self-service web site, Postgres Plus Open Source Adoption.

In this Quick Tutorial you will learn the following:

  • The variety of features of pgAgent
  • Verify a working pgAgent installation
  • Create a pgAgent job
  • Create one or more job steps for a job
  • Create one or more job schedules for a job

Feature Description

Using pgAdmin, you create a job to define what you want done and when you want it done. The specific actions that you want accomplished are defined in a series of one or more steps. When you want the actions in the steps to occur is defined in one more schedules.

The following are some of the features illustrating the power and flexibility of pgAgent:

  • Jobs can be as simple as a single step, or can include a series of multiple steps each of which can be independently activated.
  • Steps can consist of SQL statements acting upon a local or remote Postgres Plus database.
  • Steps can consist of shell script commands (for Linux systems) or batch commands (for Microsoft Windows® systems).
  • Setting up a schedule is a simple procedure. You select the times a job is to run, the day of the week it is to run, the days of the month it is to run, or months of the year it is to run. You can set up a job to run at every given date/time interval by omitting a selection in the category. For example, omitting a selection in the Months category sets the schedule so the job runs every month. In addition, you can specify exceptions to the schedule you established.
  • You can set up multiple schedules for a single job that can be independently activated.
  • A history is maintained that lets you view the outcome of past job runs.
  • Statistics are maintained that show you the last time a job was run, if it is currently running, and the next time it is scheduled to run.

Typically a single instance of pgAgent is installed and used on the database server itself, though in some circumstances it is beneficial to install one or more instances on machines other than the database server.

The pgAdmin graphical user interface (Postgres Studio on Advanced Server) is used to create and manage pgAgent jobs.

The pgAgent page is an index to the complete pgAgent documentation.

Additional information about pgAgent and the pgAgent project can be found on the Postgres Community Projects page of the EnterpriseDB web site.

Tutorial Steps

For a detailed description of the steps that show how to set up and use pgAgent with Postgres Plus Standard Server, or Advanced Server please download the PDF:

How to Setup pgAgent for Postgres Plus