Обсуждение: get current queries
is there any way to see what statements/queries are currently being passed on to the database?
> 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.
""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
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