Re: select count(*) from pg_stat_activity in V8.0.0

From: Richard Huxton <dev(at)archonet(dot)com>
To: Anony Mous <A(dot)Mous(at)shaw(dot)ca>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: select count(*) from pg_stat_activity in V8.0.0
Date: 2004-08-19 18:05:55
Message-ID: 4124EC03.2090106@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Anony Mous wrote:
> Thanks, Richard.
>
> I've never seen this behaviour before in 7.4.3 and indeed it is the only
> connection to the back end at the time when the count is occurring. However,
> it would have had the connection for at least 30 seconds before requesting a
> count.
>
> Is there a better method of obtaining the number of connections to the
> backend?

Other than "ps" - no I don't think so. The 30 seconds doesn't sound
right, Tom reckoned 0.5sec which sounds plausible. Might this be the
first query you've sent on this connection?

I'm wondering if the ODBC connection isn't actually established until
you run the first query? It doesn't sound right to me, but I don't have
any of my ODBC apps to hand at the moment to check.

Could you:
1. Connect
2. SELECT 1; (or similar)
3. Sleep from 10msec => 1sec
4. SELECT * FROM pg_stat_activity;

That way we could disable step 2 and tinker with the delay in step 3 to
see what happens.

--
Richard Huxton
Archonet Ltd

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Oleg Bartunov 2004-08-19 18:47:13 Re: Finally tsearch works ... somehow... remain a few
Previous Message Gaetano Mendola 2004-08-19 17:21:41 Re: Finally tsearch works ... somehow... remain a few