vibhorkum / pg_background

pg_background
GNU General Public License v3.0
136 stars 35 forks source link

Status of long running queries in background #28

Closed vielfarbig closed 3 years ago

vielfarbig commented 3 years ago

Hello,

is there an option to see the status of a long running query, that's in the background? I only discovered in the README, that one can fetch the results of a query, but not the status of a query. In oracle db you can do the following to see the status of user jobs with:

SELECT JOB_NAME, STATE
FROM   USER_SCHEDULER_JOBS;

as described here: https://stackoverflow.com/a/35359434

If that's not yet implemented, see this as a feature request.

rjuju commented 3 years ago

Hi @vielfarbig

sorry for the late answer. This is not implemented, and I don't think it would really make sense as pg_background is not meant to be a fully fledged scheduler. You can use pg_stat_activity view with the returned PID to see if the query is still running or not, but you won't have an history or other features that a real scheduler would offer.

There are other extensions for that in the postgres ecosystem if needed.