Re: [INTERFACES] Active users?

From: Hannu Krosing <hannu(at)trust(dot)ee>
To: Brendan McKenna <brendan(at)w3s(dot)ie>
Cc: pgsql-interfaces(at)hub(dot)org
Subject: Re: [INTERFACES] Active users?
Date: 1999-07-01 09:42:20
Message-ID: 377B37FC.C7B065A4@trust.ee
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

Brendan McKenna wrote:
>
> Hi,
>
> Is there a reliable way to determine how many (if any) users are
> currently using any given database (or whether or not postgres is currently
> in use) -- short of bringing down the postmaster and restarting it?

You can get the needed info using ps (or top)

The following is in linux (on other systens the flags to ps may differ):

[hannu(at)kodu hannu]$ ps ax | grep postgres
604 p1 S 0:00 grep postgres
600 ? S 0:00 /usr/bin/postgres localhost hannu unidocu idle

the 8th field is db name, so you can probably write a short script
(sh, awk, python, perl, ...) to do the counting.

the fields >8 is current command, so yo can check what your backends are
doing.

---------------------
Hannu

In response to

Browse pgsql-interfaces by date

  From Date Subject
Next Message JT Kirkpatrick 1999-07-01 12:38:41 RE: [ADMIN] RE: [SQL] float4
Previous Message Philippe Chaintreuil 1999-07-01 08:42:00 Getting max. value size (libpq++)