I want to run a query all X seconds on my PostgreSQL database (9.5 on Windows Systems).

I read that you can use Background Jobs to achieve this.

The pgAgent Jobs (https://www.pgadmin.org/docs/1.4/pgagent-jobs.html) are a good explanation on how to do this.

However on the installation page (https://www.pgadmin.org/docs/1.4/pgagent-install.html) they mention the security concerns about storing the password on the server / connection string.

Is there another way to run a query all X seconds on the database? Maybe there is an extension that works like oracle jobs?

  • Which operating system are you using ?
    – Sahap Asci
    Jun 16, 2016 at 9:53
  • Windows 2012 R2 and Windows 10
    – Tommy
    Jun 16, 2016 at 9:54
  • There are several different authentication methods you could try - depends on your specific setup and needs that might be more secure. However, if someone is already on your database server you probably have bigger issues :) Jun 16, 2016 at 14:36

1 Answer 1


There are lots of ways to run a scheduled job. One of them is using pgAgent. For windows you can store your password in %APPDATA%\postgresql\pgpass.conf file. Here you can find details. You can also add trust to specific ip and user from server side by changing pg_hba.conf file

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.