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.

DonwloadingPGAgent

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

InstallPgAgent

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.

PgAgentConfiguration

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

PostgersPassowrd

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.).

VerifyPGAgent

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.

CreateFirstSQLJob

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.

StepToCreate

InsertDefinition

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.

TimeToExecute

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.


Please share your ideas and opinions about this topic with me, your contribution will add true value to this topic.
If anyone has doubts on this topic then please do let me know by leaving comments or send me an email.

If you like this post, then please share it with others.
Please follow dbrnd.com, I will share my experience towards the success of Database Research and Development Activity.

I put up a post every day, please keep reading and learning.
Discover Yourself, Happy Blogging !
Anvesh M. Patel.

More from dbrnd.com

Leave a Reply

12 Comments on "How to create job in PostgreSQL"

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

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

sdorttuiiplmnr
Guest

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

Octavi
Guest

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
Guest

Great post. Thanks for the read.

maryann
Guest

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.

Glinda
Guest

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

Cubias
Guest

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.

Rod
Guest

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

Thomasor
Guest

Thanks for giving these types of wonderful content material.

Raleigh
Guest

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.

Olek
Guest

You can simply create PostgreSQL backup job with the help of GUI tool PostgreSQL-Backup http://postgresql-backup.com/

trackback

thank you for this information….
god bless you…

wpDiscuz