Re: further meta-data in pg_stat_activity?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Andrew Hammond" <andrew(dot)george(dot)hammond(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: further meta-data in pg_stat_activity?
Date: 2006-06-17 04:05:31
Message-ID: 10885.1150517131@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"Andrew Hammond" <andrew(dot)george(dot)hammond(at)gmail(dot)com> writes:
> How much work would it be to implement and how valuable would people
> find the following additions to pg_stat_activity?

I won't speak to the "how valuable" bit, but as far as costs go,
I think:

> 1) # of transactions committed on this connection since start
> 2) # of transactions rolled back

Trivial, we report these to the stats collector already, they're just
not summed in this particular fashion.

> 3) milliseconds used processing requests
> 4) milliseconds idle in transaction
> 5) milliseconds idle

All moderately expensive, we're talking at least two additional kernel
calls per request to get the information.

> 6) this is the n'th backend spawned since the postmaster started

Cheap on Unix, not so cheap on Windows, usefulness pretty questionable.

> 7) this is the n'th backend for the given client_addr
> 8) this is the n'th backend for the given user

Both *exceedingly* expensive --- where are you going to sum these?
The postmaster does not even have a way to count the second, because
it forks off the subprocess before receiving the connection request
packet which contains the user name.

> 9) timestamp for start of the current transaction (null if idle?)

Don't we do that already?

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Lor 2006-06-17 04:17:04 Re: Sun Donated a Sun Fire T2000 to the PostgreSQL community
Previous Message Tom Lane 2006-06-17 02:58:05 Exporting type OID macros in a cleaner fashion