pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Steve Crawford <scrawford@pinpointresearch.com>
To: Bèrto ëd Sèra <berto.d.sera@gmail.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Setting the process title, or can I?
Date: Tue, 20 Mar 2012 08:18:32 -0700
Message-ID: <4F689FC8.4090908@pinpointresearch.com> (raw)
In-Reply-To: <CAKwGa_9MOQ1zsFaXcdyaCqbPUNDXhMHPOzpo1SSxME8a5YJ2UA@mail.gmail.com>
References: <CAKwGa_9MOQ1zsFaXcdyaCqbPUNDXhMHPOzpo1SSxME8a5YJ2UA@mail.gmail.com>

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




view thread (5+ messages)  latest in thread

Message-ID: <4F689FC8.4090908@pinpointresearch.com>
Permalink:  ../4F689FC8.4090908@pinpointresearch.com/
Also on:    postgresql.org/message-id/4F689FC8.4090908@pinpointresearch.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: scrawford@pinpointresearch.com, berto.d.sera@gmail.com
  Subject: Re: Setting the process title, or can I?
  In-Reply-To: <4F689FC8.4090908@pinpointresearch.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox