pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Associating client PIDs with backend PIDs
3+ messages / 3 participants
[nested] [flat]

* Associating client PIDs with backend PIDs
@ 2003-11-24 16:55 Rich Cullingford <rculling@sysd.com>
  2003-11-24 20:34 ` Re: Associating client PIDs with backend PIDs Björn Lundin <bjorn.lundin@swipnet.se>
  0 siblings, 1 reply; 3+ messages in thread

From: Rich Cullingford @ 2003-11-24 16:55 UTC (permalink / raw)
  To: pgsql-admin

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).

                   Thanks for any help,
                   Rich Cullingford
                   rculling@sysd.com




^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Associating client PIDs with backend PIDs
  2003-11-24 16:55 Associating client PIDs with backend PIDs Rich Cullingford <rculling@sysd.com>
@ 2003-11-24 20:34 ` Björn Lundin <bjorn.lundin@swipnet.se>
  0 siblings, 0 replies; 3+ messages in thread

From: Björn Lundin @ 2003-11-24 20:34 UTC (permalink / raw)
  To: pgsql-admin

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




^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Associating client PIDs with backend PIDs
@ 2003-11-25 00:30 washirv <washirv@myway.com>
  0 siblings, 0 replies; 3+ messages in thread

From: washirv @ 2003-11-25 00:30 UTC (permalink / raw)
  To: rculling@sysd.com; pgsql-admin


I use a separate command like lsof to map processes to tcp/unix ports on the client and server machines.



 --- On Mon 11/24, Rich Cullingford < rculling@sysd.com > wrote:
From: Rich Cullingford [mailto: rculling@sysd.com]
To: pgsql-admin@postgresql.org
Date: Mon, 24 Nov 2003 11:55:07 -0500
Subject: [ADMIN] Associating client PIDs with backend PIDs

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

_______________________________________________
No banners. No pop-ups. No kidding.
Introducing My Way - http://www.myway.com



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2003-11-25 00:30 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-11-24 16:55 Associating client PIDs with backend PIDs Rich Cullingford <rculling@sysd.com>
2003-11-24 20:34 ` Björn Lundin <bjorn.lundin@swipnet.se>
2003-11-25 00:30 Re: Associating client PIDs with backend PIDs washirv <washirv@myway.com>

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