Re: BUG #5370: Shortcut for currently connected users - Mailing list pgsql-bugs

From Bruce Momjian
Subject Re: BUG #5370: Shortcut for currently connected users
Date
Msg-id 201003112338.o2BNcnl04212@momjian.us
Whole thread Raw
In response to BUG #5370: Shortcut for currently connected users  ("Igor Moiseev" <moiseev.igor@gmail.com>)
Responses Re: BUG #5370: Shortcut for currently connected users  (Igor Moiseev <moiseev.igor@gmail.com>)
List pgsql-bugs
Igor Moiseev wrote:
>
> The following bug has been logged online:
>
> Bug reference:      5370
> Logged by:          Igor Moiseev
> Email address:      moiseev.igor@gmail.com
> PostgreSQL version: 8.3.9
> Operating system:   Ubuntu
> Description:        Shortcut for currently connected users
> Details:
>
> Dear developers, thank you for the perfect product!
>
> I'd like to request one shortcut in psql terminal. That would simplify a lot
> manual administrating of postgresql servers! The query I need always to
> execute is
>
> select * from pg_stat_activity ;
>
> That would be nice to have something like "\cu" as a shortcut for this
> query!!

Add this to your ~/.psqlrc:

    \set mon 'SELECT * FROM pg_stat_activity';

and then you can use this in psql:

    test=> :mon
     datid | datname | procpid | usesysid | usename  | application_name |
     ...

--
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  PG East:  http://www.enterprisedb.com/community/nav-pg-east-2010.do

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #5365: pg_ctl start gives error
Next
From: Gurjeet Singh
Date:
Subject: Re: log : bad file dscriptor????