Postgresql – Background Jobs in PostgreSQL

postgresql

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?

Best Answer

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