Re: Postmaster not reporting number of connections correctly

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "A(dot) Mous" <a(dot)mous(at)shaw(dot)ca>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Postmaster not reporting number of connections correctly
Date: 2005-05-05 17:21:58
Message-ID: 24993.1115313718@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"A. Mous" <a(dot)mous(at)shaw(dot)ca> writes:
> I've been using 8.0 ever since beta 1, and am currently on 8.0.1. I have
> noticed (in each version) that the number of records in the pg_stat_activity
> table is not always representative of the number of connections to the
> server. That is, we have an installation at a client's site that runs a
> nightly batch and reports the results of the run back to us. One of the
> items reported is a count of the number of records in pg_stat_activity (a
> section of the batch is dependent on whether or not any client connections
> exist). Every now and then we'll see that the number of records in this
> table is zero, when there should always be at least one since our batch is
> connected when it runs. I've also seen this myself when querying the table
> (zero reported connections).

Is this being checked within a short time after connection? The stats
views lag behind reality (by up to 500ms, if memory serves).

> Is there a better way of obtaining the number of connections to the
> postmaster?

I think it's a bad idea to imagine that you could ever know that with
certainty --- even if the number is correct when obtained, it could well
be obsolete by the time it's delivered to the client.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Don Laurine 2005-05-05 18:07:10 ECPG - Timestamp to ascii Conversion PG version 7.4
Previous Message A. Mous 2005-05-05 16:56:35 Postmaster not reporting number of connections correctly