On Mon, 08 Nov 2004 12:56:57 -0500
Jan Wieck <JanWieck@Yahoo.com> wrote:
Hi Jan.
> On 11/8/2004 12:03 PM, D'Arcy J.M. Cain wrote:
>
> > I checked the FAQ and docs but haven't found anything definitive.
> > This is my SQL test script:
> >
> > SELECT pg_backend_pid();
> > SELECT * FROM pg_stat_activity order by procpid;
> >
> > When I run psql reading that I find that my backend procpid is not
> > in the list. I know that I can see it if I can introduce a little
> > sleep (1 second) between the connection and the reading of
> > pg_stat_activity.
>
> That is because the way your backend gets the information from the
> pgstat daemon process is by reading a file, which is at maximum
> written by that process every 500 msec. You will hardly ever see your
> own query.
OK, I thought that using stats might not be the most reliable method but
I couldn't find any other. Is there a reliable way to get that info?
Note that I don't care what the backend is doing, just whether it is
still running or not.
> All these statistics are unreliable "by design", as explained numerous
>
> times on this list. In short, a backend should never be slowed down
> because the pgstat process can't swallow the stats fast enough. That
> is the reason for using UDP in the first place. So the kernel is
> allowed to drop stats packets, but not to block a backend.
So it is worse than I thought. I thought that it was slow but it looks
like it may never even make it. Probably OK for my purposes but it
would be nice to have a reliable method.
--
D'Arcy J.M. Cain <darcy@druid.net> | Democracy is three wolves
http://www.druid.net/darcy/ | and a sheep voting on
+1 416 425 1212 (DoD#0082) (eNTP) | what's for dinner.