How to create job in PostgreSQL

You can configure your recurring tasks by creating database jobs in PostgreSQL. PostgreSQL provides one external tool to configure sql job, name is PGAgent.

PGAgent is an external tool by the Postgres community which is used to create and manage database jobs.

Below is demonstration to configure PGAgent in a windows environment using PGAdmin.

How to configure PGAgent in PostgreSQL (windows) ?

Step 1 : download PGAgent using Stack Builder. Go to your postgres option menu where you can find one more link for Stack Builder. Now, as per below image select pgAgent and press Next.


Stack Builder

Step 2: Now it will automatically download pgAgent  so wait for few minutes and please make sure that your internet connection is working.


Step 3: After completion of download you can screen of PGAgent for further installation.


Step 4 : Configure authentication detail to access Postgres database server. Please note that PGAgent is only run under super user access. In below image postgres is super user of PostgreSQL Database Server.


Step 5 : Configure local postgres client password. You can visit this link for more details on client password location. 


Step 6 : Now complete PGAgent installation and verify using PGAdmin. You can find one new pgAgent catalogs in postgres database. As marked below you can also find Job icon in main category.

Note : Only super user or administrator can create and manage this job. This icon is only visible to administrator login (postgres super user login.).


Step 7 : To create you first SQL Job. Right click on job and select to create new SQL Job. Give name of your job and prepare for next step. Make sure that job is Enabled.


Step 8: Create definition of job. Give name of step and define definition or action script into Definition tab. you can also select remote option when job is require to execute on remote machine.



Step 9: Now create a schedule to execute SQL Job. In this window you can select Days and times. Select all means at every minute, hour, day.


Now your PGAgent tool is configured and also we have created one Job to insert test data into table at every minute.

Please note : This PGAgent / Database Job is only create and manage by administrator and other database user can not even see this jobs.

Anvesh Patel

Leave a Reply

12 Comments on "How to create job in PostgreSQL"

Notify of
Sort by:   newest | oldest | most voted
sdorttuii plmnr

I really enjoy studying on this website , it holds superb content. “You should pray for a sound mind in a sound body.” by Juvenal.


Glad to be one of the visitors on this awesome web site : D.


It’s really a nice and useful piece of info. I’m glad that you shared this helpful info with us. Please keep us informed like this. Thanks for sharing.

Sara Andrulis

Great post. Thanks for the read.


Hello very nice blog!! Man .. Excellent .. Wonderful .. I will bookmark your site and take the feeds also…I am happy to seek out so many useful information here within the put up, we’d like work out extra strategies on this regard, thank you for sharing.


Hi there, just desired to say, I liked this blog post. It was
practical. Carry on posting!


Very great information can be found on website . “Even if happiness forgets you a little bit, never completely forget about it.” by Donald Robert Perry Marquis.


really enjoyed studying you are a very smart person thanks for finally talking about this valuable information


Thanks for giving these types of wonderful content material.


Heya i’m for the first time here. I found this board and I find It truly useful & it helped me out much. I hope to give something back and help others like you aided me.


You can simply create PostgreSQL backup job with the help of GUI tool PostgreSQL-Backup


thank you for this information….
god bless you…