pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
get current queries
4+ messages / 4 participants
[nested] [flat]

* get current queries
@ 2003-08-18 09:22 Ramil Sagum <ramil@astra.ph>
  2003-08-18 12:05 ` Re: get current queries Rudi Starcevic <rudi@oasis.net.au>
  2003-08-18 12:37 ` Re: get current queries Mendola Gaetano <mendola@bigfoot.com>
  2003-08-20 09:54 ` Re: get current queries Chris Miles <chris@psychofx.com>
  0 siblings, 3 replies; 4+ messages in thread

From: Ramil Sagum @ 2003-08-18 09:22 UTC (permalink / raw)
  To: pgsql-admin



is there any way to see what statements/queries are currently being passed
on to the database?





^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: get current queries
  2003-08-18 09:22 get current queries Ramil Sagum <ramil@astra.ph>
@ 2003-08-18 12:05 ` Rudi Starcevic <rudi@oasis.net.au>
  2 siblings, 0 replies; 4+ messages in thread

From: Rudi Starcevic @ 2003-08-18 12:05 UTC (permalink / raw)
  To: Ramil Sagum <ramil@astra.ph>; pgsql-admin

> is there any way to see what statements/queries are currently being passed
> on to the database?

Yes - I haven't got around to installing it yet but 'pgmonitor' over
at http://gborg.postgresql.org/project/pgmonitor/projdisplay.php sounds
like what your after.

Here's the overview:
"This is a Tcl/Tk script that displays current database connections, and
allows you to view the currently executing query, cancel the query, or
terminate the session. You can also start/stop the postmaster."

I believe it requires X on your database server.

I haven't got X on my database server so I have used it yet but it looks
really cool.

For you other Admin's do you have X on your servers ?

Cheers
Rudi.




^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: get current queries
  2003-08-18 09:22 get current queries Ramil Sagum <ramil@astra.ph>
@ 2003-08-18 12:37 ` Mendola Gaetano <mendola@bigfoot.com>
  2 siblings, 0 replies; 4+ messages in thread

From: Mendola Gaetano @ 2003-08-18 12:37 UTC (permalink / raw)
  To: pgsql-admin; +Cc: \"Ramil Sagum\" <ramil@astra.ph>

""Ramil Sagum"" <ramil@astra.ph> wrote:
>
>
> is there any way to see what statements/queries are currently being passed
> on to the database?

select * from pg_stat_activity;



Regards
Gaetano Mendola





^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: get current queries
  2003-08-18 09:22 get current queries Ramil Sagum <ramil@astra.ph>
@ 2003-08-20 09:54 ` Chris Miles <chris@psychofx.com>
  2 siblings, 0 replies; 4+ messages in thread

From: Chris Miles @ 2003-08-20 09:54 UTC (permalink / raw)
  To: Ramil Sagum <ramil@astra.ph>; +Cc: pgsql-admin@postgresql.org, Chris Miles <chris@psychofx.com>

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




^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2003-08-20 09:54 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-08-18 09:22 get current queries Ramil Sagum <ramil@astra.ph>
2003-08-18 12:05 ` Rudi Starcevic <rudi@oasis.net.au>
2003-08-18 12:37 ` Mendola Gaetano <mendola@bigfoot.com>
2003-08-20 09:54 ` Chris Miles <chris@psychofx.com>

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