From: Chris Miles <chris@psychofx.com>
To: Ramil Sagum <ramil@astra.ph>
Cc: pgsql-admin@postgresql.org, Chris Miles <chris@psychofx.com>
Subject: Re: get current queries
Date: Wed, 20 Aug 2003 10:54:11 +0100
Message-ID: <3F434543.4040104@psychofx.com> (raw)
In-Reply-To: <EAEOLPGODOMBHHPFIPGOAENBCAAA.ramil@astra.ph>
References: <EAEOLPGODOMBHHPFIPGOAENBCAAA.ramil@astra.ph>
There is a simple way to get this all from psql.
First edit postgresql.conf and make sure:
stats_command_string = true
(and restart or HUP postmaster if necessary)
Then connect to your database and use my favorite query:
SELECT datname,procpid,current_query FROM pg_stat_activity ORDER BY procpid;
which will give you database name, pid and current query (or <IDLE>) for
each current connection to the database.
Note that you will see queries for all databases, not just the one you
connected to.
This is what I use for 7.1, I don't know if it differs for newer versions.
Cheers,
CM
--
Chris Miles
http://chrismiles.info/
Ramil Sagum wrote:
>
> is there any way to see what statements/queries are currently being passed
> on to the database?
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 7: don't forget to increase your free space map settings
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-admin@postgresql.org
Cc: chris@psychofx.com, ramil@astra.ph
Subject: Re: get current queries
In-Reply-To: <3F434543.4040104@psychofx.com>
References: <EAEOLPGODOMBHHPFIPGOAENBCAAA.ramil@astra.ph> <3F434543.4040104@psychofx.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox