Hi everybody,
I'm currently working on something like a `mytop' clone,
also written in Perl with DBI + DBD::Pg interface.
mytop is a command line utility that displays mysql
server status and clients connected modeled after
`top' unix utility. (http://mytop.sourceforge.net).
What I'd like to achieve is something like that, but
for PostgreSQL, of course.
Now the project is in the very early stages, but it
already does something useful with Pg backend versions 7.2+
with stats enabled. Obviously, it looks at pg_stat*
relations to extract some useful information.
There are some things that are nice in `mytop', and I
think it would be nice to have also in `pgtop', but I
don't know how to replicate them:
1) is it possible to know Pg backend uptime with
SQL queries? Or must I look at postmaster.pid file?
or even something else?
2) how can I know the ip addresses/hostnames of clients
connecting to server?
3) Is there a way to know the number of queries performed
against Pg backend (by each client)? Can I distinguish
between selects / updates / inserts / copy / ... ?
If you want to take a look at it, point your
browser at http://search.cpan.org/dist/pgtop .
--
Cosimo