Thread: Server status query problem

Server status query problem

From
Dave Page
Date:
Hi Andreas,

It was pointed out to me that the server status lock tab doesn't show data
correctly - specifically, the username is always blank, and the query string
normally shows up as <backend information unavailable>.

It seems the cause is that most of the stats functions don't take a PID as
an argument, but a backend ID between 1 and the current number of backends.

A hacked together replacement query looks like the following, but before I
appy it I just wanted to run it past you and the list in case I missed
anything:

SELECT
  (SELECT datname FROM pg_database WHERE oid = pgl.database) AS dbname,
  pgl.relation::regclass AS class,
  pg_get_userbyid(pg_stat_get_backend_userid(svrid)) as user,
  pgl.transaction,
  pg_stat_get_backend_pid(svrid) AS pid,
  pgl.mode,
  pgl.granted,
  pg_stat_get_backend_activity(svrid) AS current_query
FROM
  pg_stat_get_backend_idset() svrid,
  pg_locks pgl
WHERE
  pgl.pid = pg_stat_get_backend_pid(svrid)
ORDER BY
  pid;

Regards, Dave



Re: Server status query problem

From
Andreas Pflug
Date:
Dave Page wrote:
> Hi Andreas,
>
> It was pointed out to me that the server status lock tab doesn't show data
> correctly - specifically, the username is always blank, and the query string
> normally shows up as <backend information unavailable>.
>
> It seems the cause is that most of the stats functions don't take a PID as
> an argument, but a backend ID between 1 and the current number of backends.
>
> A hacked together replacement query looks like the following, but before I
> appy it I just wanted to run it past you and the list in case I missed
> anything:

Arg....
Testing for HOURS, coding it but you already committed it...


Regards,
Andreas

Re: Server status query problem

From
"Dave Page"
Date:

-----Original Message-----
From: "Andreas Pflug"<pgadmin@pse-consulting.de>
Sent: 27/11/05 18:01:01
To: "Dave Page"<dpage@vale-housing.co.uk>
Cc: "pgadmin-hackers"<pgadmin-hackers@postgresql.org>
Subject: Re: Server status query problem

> Arg....
> Testing for HOURS, coding it but you already committed it...

Sorry, I left it almost a week first - and figured you just had no objections.

/D

-----Unmodified Original Message-----
Dave Page wrote:
> Hi Andreas,
>
> It was pointed out to me that the server status lock tab doesn't show data
> correctly - specifically, the username is always blank, and the query string
> normally shows up as <backend information unavailable>.
>
> It seems the cause is that most of the stats functions don't take a PID as
> an argument, but a backend ID between 1 and the current number of backends.
>
> A hacked together replacement query looks like the following, but before I
> appy it I just wanted to run it past you and the list in case I missed
> anything:

Arg....
Testing for HOURS, coding it but you already committed it...


Regards,
Andreas