From: | Steve Crawford <scrawford(at)pinpointresearch(dot)com> |
---|---|
To: | Bèrto ëd Sèra <berto(dot)d(dot)sera(at)gmail(dot)com> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: Setting the process title, or can I? |
Date: | 2012-03-20 15:18:32 |
Message-ID: | 4F689FC8.4090908@pinpointresearch.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
On 03/20/2012 03:14 AM, Bèrto ëd Sèra wrote:
>
> I currently have an emergency ... As an emergency procedure we have
> set a script that each minute has a look at the situation and runs
> pg_cancel_backend() against anything that has been waiting for more
> than X secs. Then it sleeps one more minute...
...
> Is there anyway I can mark the process running the filter, maybe using
> the update_process_title feature? I'd like to have something I can see
> from a ps command, grep for it and kill -15 it, without wasting our
> scarce resources on one more pg process to use info from pg_stat_activity.
>
Several things spring to mind.
1. The script that starts the filter can note its pid and set an at-job
to kill it after 30 minutes. I've used this technique with success.
2. Create a new role specifically to run the filter. The role is
generally visible in ps.
But this all begs the question. Why not:
3. Set the statement_timeout so long-running statements will be
automatically killed. This can be done on a per-role basis so simply set
it as desired for the role used by the problematic Java program. It is a
default and can be changed by the user so if there are individual
statements that need a longer timeout you can change just for those
statements.
Cheers,
Steve
From | Date | Subject | |
---|---|---|---|
Next Message | Bèrto ëd Sèra | 2012-03-20 15:24:11 | Re: Setting the process title, or can I? |
Previous Message | Bèrto ëd Sèra | 2012-03-20 11:33:26 | Re: Setting the process title, or can I? |