Re: Terminating a rogue connection

From: Mark Morgan Lloyd <markMLl(dot)pgsql-general(at)telemetry(dot)co(dot)uk>
To: pgsql-general(at)PostgreSQL(dot)org
Subject: Re: Terminating a rogue connection
Date: 2012-07-27 09:09:00
Message-ID: jutlrd$pea$1@pye-srv-01.telemetry.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Chris Angelico wrote:
> On Fri, Jul 27, 2012 at 6:27 PM, Mark Morgan Lloyd
> <markMLl(dot)pgsql-general(at)telemetry(dot)co(dot)uk> wrote:
>> Assuming a *nix server: if a monitoring program determines that an
>> established connection appears to be trying to so something inappropriate,
>> what's the best way of terminating that session rapidly?
>
> select pg_terminate_backend(procpid) from pg_stat_activity where .....
>
> The main difficulty is recognizing which PID to terminate, though.

Exactly :-)

I'd add that this is a hypothetical situation at present, I'm just
trying to plan ahead.

> There's a good lot of information available in pg_stat_activity;
> logins, application names, and connection IP addresses are handy here.
> But ultimately, it's just pg_terminate_backend.
>
> ChrisA

--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Guillaume Lelarge 2012-07-27 09:38:49 Re: postgres maintenance db
Previous Message Bèrto ëd Sèra 2012-07-27 08:41:17 Re: Terminating a rogue connection