Re: procpid? - Mailing list pgsql-hackers

From Robert Haas
Subject Re: procpid?
Date
Msg-id BANLkTino=7bxm9r-aRbQwWTEW2PUKtm_kQ@mail.gmail.com
Whole thread Raw
In response to Re: procpid?  (Gurjeet Singh <singh.gurjeet@gmail.com>)
Responses Re: procpid?
List pgsql-hackers
On Wed, Jun 15, 2011 at 9:44 AM, Gurjeet Singh <singh.gurjeet@gmail.com> wrote:
> Why not expose this new information as functions instead of a new view, like
> we do for pg_is_in_replication(). People can use whatever alias they want in
> the queries they write.
>
> SELECT get_current_query(pid), is_idle(pid), is_idle_in_transaction(pid),
> transaction_start_time(pid), .... FROM (select procpid as pid FROM
> pg_stat_activity);
>
> Then pg_activity (or whatever we name it later) would also be a view on top
> of these functions.

Well, that would probably be a lot slower, and wouldn't necessarily
deliver as consistent a snapshot of system activity.  It's better to
have one set-returning function that dumps out all the data in a
single pass.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


pgsql-hackers by date:

Previous
From: "Joshua D. Drake"
Date:
Subject: Re: procpid?
Next
From: Gurjeet Singh
Date:
Subject: Re: procpid?