pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Björn Lundin <bjorn.lundin@swipnet.se>
To: pgsql-admin@postgresql.org
Subject: Re: Associating client PIDs with backend PIDs
Date: Mon, 24 Nov 2003 21:34:36 +0100
Message-ID: <bptps4$14fb$1@news.hub.org> (raw)
References: <3FC237EB.3050302@sysd.com>

Rich Cullingford wrote:

> All,
> This is a pretty obvious question, but I can't find an answer in the
> standard docs/archive: if I have an installation in which there are a
> number of long-running client processes interacting (one-on-one) with
> backend processes, how do I find the associations? I can see the client
> PIDs in an appropriate 'ps' (grepping on the client program name, for
> example), and the backend PIDs in the standard queries or pgmonitor. But
> I can't tell which goes with which (except by trying to infer the
> association by looking at the query that's running -- assuming I can
> catch it).

if your client uses libpq, you could use

PQbackendPID Returns the process ID of the backend server handling this
connection. 

int PQbackendPID(const PGconn *conn);
       
to save the backend's pid to a known file after you connected

/Björn

> 
>                    Thanks for any help,
>                    Rich Cullingford
>                    rculling@sysd.com
> 
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 8: explain analyze is your friend




view thread (3+ messages)  latest in thread

Message-ID: <bptps4$14fb$1@news.hub.org>
Permalink:  ../bptps4$14fb$1@news.hub.org/
Also on:    postgresql.org/message-id/bptps4$14fb$1@news.hub.org

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: bjorn.lundin@swipnet.se
  Subject: Re: Associating client PIDs with backend PIDs
  In-Reply-To: <bptps4$14fb$1@news.hub.org>
  References: <3FC237EB.3050302@sysd.com> <bptps4$14fb$1@news.hub.org>

* 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