any way to query for current connections to db?
Hi,
Is there any way to query the database to identify what the current
connections are (connections, sessions, or whatever you want to call
them)?
This would be something similar to oracle's v$session view.
Thanks,
Matt
Is there any way to query the database to identify what the current
connections are (connections, sessions, or whatever you want to call them)?
select * from pg_stat_activity;
Jeff Larsen wrote:
Is there any way to query the database to identify what the current
connections are (connections, sessions, or whatever you want to call them)?select * from pg_stat_activity;
Is this an FAQ?
--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://postgres.enterprisedb.com
+ If your life is a hard drive, Christ can be your backup. +
On Nov 9, 2007 4:36 PM, Coarr, Matt <mcoarr@mitre.org> wrote:
Is there any way to query the database to identify what the current
connections are (connections, sessions, or whatever you want to call them)?This would be something similar to oracle's v$session view.
select * from pg_stat_activity where datname='mydbname'
should get you started.
You can see all the system tables with
\dS
in psql
select
*
from
pg_stat_activity
where
datname = (
select
*
from
current_database()
);
-------- Original Message --------
Subject: [GENERAL] any way to query for current connections to db?
From: "Coarr, Matt" <mcoarr@mitre.org>
Date: Fri, November 09, 2007 5:36 pm
To: <pgsql-general@postgresql.org>
Hi,
Is there any way to query the database to identify what the current
connections are (connections, sessions, or whatever you want to call
them)?
This would be something similar to oracle's v$session view.
Thanks,
Matt
Import Notes
Resolved by subject fallback
On Nov 9, 2007 4:57 PM, Bruce Momjian <bruce@momjian.us> wrote:
Jeff Larsen wrote:
Is there any way to query the database to identify what the current
connections are (connections, sessions, or whatever you want to call them)?select * from pg_stat_activity;
Is this an FAQ?
Yes, it gets asked a lot.
Is it in the FAQ? Don't know.
Is this an FAQ?
Yes, it gets asked a lot.
Is it in the FAQ? Don't know.
In the FAQ? No
In the Manual? Yes
Scott Marlowe wrote:
On Nov 9, 2007 4:57 PM, Bruce Momjian <bruce@momjian.us> wrote:
Jeff Larsen wrote:
Is there any way to query the database to identify what the current
connections are (connections, sessions, or whatever you want to call them)?select * from pg_stat_activity;
Is this an FAQ?
Yes, it gets asked a lot.
Is it in the FAQ? Don't know.
No, it isn't.
--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://postgres.enterprisedb.com
+ If your life is a hard drive, Christ can be your backup. +