Is there any way to inform user that your query has been running more than x minutes, so admin has killed your session. This is especially to the query or read only user.

I have a function which will do exactly what I want (Im running the function periodically). But, I couldn't notice the user that their connection being killed by admin.

Users are using PgAdmin/psql/DBeaver as client. I am not sure, how can I show the message to them. Is there anyway at all notify the user in their session window?

(Initially I tried to do kind of logon trigger. Unfortunately, postgres doesn't have the feature yet)

| improve this question | | | | |
  • Don't the users clients display an error message when their queries are being killed? – dezso May 7 '19 at 7:48
  • @dezso yeah I get that. I meant to display custom messages. For an example, your query killed due to this reason. I have few checks in my function like, more than x minutes the query is running or session is idle for more than x minutes (this is only for read-only users). So, I need to display the exact message to the client if possible, I know its kind of client/server level module which has to be done. However, I am curious to know if there is any existing approach? – Spike May 7 '19 at 7:53
  • Instant messenger? Email? Phone? In person? This should happen rarely enough. User education is an important aspect. – Colin 't Hart May 7 '19 at 8:50
  • @dezso I think the function he refers to is the killer, not the killee, so raising notice to itself would not accomplish much. – jjanes May 7 '19 at 15:42

This feature has been proposed with an implementation, but did not make it into version 12. Maybe it will be in version 13. (If you can test the patch and provide feedback, you can increase the odds of that happening)

| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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