pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Determine current running query, but no query in pg_stat_activity
3+ messages / 2 participants
[nested] [flat]

* Determine current running query, but no query in pg_stat_activity
@ 2005-03-29 15:03  Adam Witney <awitney@sghms.ac.uk>
  0 siblings, 1 reply; 3+ messages in thread

From: Adam Witney @ 2005-03-29 15:03 UTC (permalink / raw)
  To: pgsql-admin


Hi,

I have a process running and I am trying to work out what it is doing.
Supposedly it is running a SELECT

23093 ?        R      6:35 postgres: lubrook bugasbase  SELECT

However in pg_stat_activity, I get no current_query

bugasbase=# SELECT * from pg_stat_activity ;
  datid   |  datname  | procpid | usesysid | usename | current_query |
query_start 
----------+-----------+---------+----------+---------+---------------+------
-------
 80573819 | bugasbase |   23117 |        1 | pgsql   |               |
 80573819 | bugasbase |   23093 |      109 | lubrook |               |

Shouldn't there be something in current_query?

Thanks for any advice

Adam


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.




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

* Re: Determine current running query, but no query in pg_stat_activity
@ 2005-03-29 15:27  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Adam Witney <awitney@sghms.ac.uk>
  0 siblings, 0 replies; 3+ messages in thread

From: Tom Lane @ 2005-03-29 15:27 UTC (permalink / raw)
  To: Adam Witney <awitney@sghms.ac.uk>; +Cc: pgsql-admin

Adam Witney <awitney@sghms.ac.uk> writes:
> Shouldn't there be something in current_query?

Only if (a) you have stats_command_string turned on, *and* (b) you
are a superuser or the owner of the target process.

			regards, tom lane



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

* Re: Determine current running query, but no query in pg_stat_activity
@ 2005-03-29 16:02  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 3+ messages in thread

From: Tom Lane @ 2005-03-29 16:02 UTC (permalink / raw)
  To: Adam Witney <awitney@sghms.ac.uk>; +Cc: pgsql-admin

Adam Witney <awitney@sghms.ac.uk> writes:
> I am logged in as the superuser, and I just switched stats_command_string
> on.

Just now?  Too late then --- it needed to be on at the time the other
guy started his query, else he did not send the string to the stats
collector.

> I did find a reference on google to the fact that there was/is a max query
> size length for this?

Yeah, but it truncates, it doesn't just drop the string.

If you are feeling desperate you can attach to the other backend with
gdb:

	$ gdb /path/to/postgres backend-PID
	gdb> print debug_query_string
	gdb> quit
	detach and let process continue? y
	$

			regards, tom lane



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


end of thread, other threads:[~2005-03-29 16:02 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-03-29 15:03 Determine current running query, but no query in pg_stat_activity Adam Witney <awitney@sghms.ac.uk>
2005-03-29 15:27 ` Tom Lane <tgl@sss.pgh.pa.us>
2005-03-29 16:02 Re: Determine current running query, but no query in pg_stat_activity Tom Lane <tgl@sss.pgh.pa.us>

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